From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: bug in expansion of variables in babel Perl Date: Sun, 24 Feb 2013 14:08:45 +0100 Message-ID: <87mwutzwo2.fsf@Rainer.invalid> References: <87ppzq138q.fsf@mn.cs.uvic.ca> <87mwuuyprm.fsf@mn.cs.uvic.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9bKV-0000Bo-BJ for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 08:09:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9bKR-0000D8-GM for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 08:09:23 -0500 Received: from plane.gmane.org ([80.91.229.3]:36402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9bKR-0000Cy-AU for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 08:09:19 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U9bKg-0003p0-GN for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 14:09:34 +0100 Received: from pd9eb4dc7.dip.t-dialin.net ([217.235.77.199]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Feb 2013 14:09:34 +0100 Received: from Stromeko by pd9eb4dc7.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Feb 2013 14:09:34 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org D M German writes: […] Please leave the formats alone, if you change the number of parameters there folks that use their own definitions won't know what hit them. What you want is to prepend something to the body that Babel gives you, so let-bind that result and use it. You could even advise the function and have it submit to your will without changing Org. --8<---------------cut here---------------start------------->8--- (defun org-babel-perl-evaluate (session ibody &optional result-type) "Pass BODY to the Perl process in SESSION. If RESULT-TYPE equals 'output then return a list of the outputs of the statements in BODY, if RESULT-TYPE equals 'value then return the value of the last statement in BODY, as elisp." (when session (error "Sessions are not supported for Perl")) (let ((body (concat org-babel-perl-preface ibody))) (case result-type (output (org-babel-eval org-babel-perl-command body)) (value (let ((tmp-file (org-babel-temp-file "perl-"))) (org-babel-eval org-babel-perl-command (format org-babel-perl-wrapper-method body (org-babel-process-file-name tmp-file 'noquote))) (org-babel-eval-read-file tmp-file)))))) --8<---------------cut here---------------end--------------->8--- BTW, now that I think some more about it: debugging Perl is much easier than you seem to let on: (setq org-babel-perl-command "perl -Mstrict -ne print"). This will echo the program sent to Perl in full glory into the output block. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Waldorf MIDI Implementation & additional documentation: http://Synth.Stromeko.net/Downloads.html#WaldorfDocs