From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: [PATCH] bug in expansion of variables in babel Perl Date: Sat, 02 Mar 2013 23:01:52 +0100 Message-ID: <87d2vh8nqn.fsf@Rainer.invalid> References: <87ppzq138q.fsf@mn.cs.uvic.ca> <87d2vphccc.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBuVT-00088z-EY for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 17:02:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBuVS-0005f2-4A for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 17:02:15 -0500 Received: from plane.gmane.org ([80.91.229.3]:33097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBuVR-0005ew-V2 for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 17:02:14 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UBuVk-0006h5-1G for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 23:02:32 +0100 Received: from pd9eb5ca3.dip.t-dialin.net ([217.235.92.163]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 Mar 2013 23:02:32 +0100 Received: from Stromeko by pd9eb5ca3.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 Mar 2013 23:02:32 +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 Achim Gratz writes: > Here are two patches that fix this and implement (partly) some of your > suggestions. I don't think Org should pollute the global Perl namespace > by default, so I've left the definition of org-babel-perl-preface to the > user for now. The second patch has the debugging aid you've been > requesting, if you bind the symbol org-babel--debug-input to anything > the temporary input files won't be deleted after the code has run. I've pushed these changes with some extended babel support for Perl: the results are now interpreted by babel, like for most other languages. Also, the wrapper has been extended to be a bit smarter: if the return value is an arrayref (or arrayref of arrayrefs), the wrapper automatically formats the output so that it will be interpreted as a table (a simple arrayref will be interpreted as a column vector). In particular that means you can pass a table through a Perl source block with exactly no code to write (as the variable that is input will be returned directly). In all other cases the return value is simply printed, so it should be a scalar. I've kept the wrapper as an (anonymous) subroutine, so if anybody had latched onto "return $rv;" it will continue to work. Also a few tests were added. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada