From mboxrd@z Thu Jan 1 00:00:00 1970 From: D M German Subject: Re: evaluation of perl in babel Date: Mon, 25 Feb 2013 01:54:11 -0800 Message-ID: <87zjysu3b0.fsf@mn.cs.uvic.ca> References: <87hal1whbc.fsf@mn.cs.uvic.ca> <87wqtxfjpb.fsf@Rainer.invalid> Reply-To: dmg@uvic.ca Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9ulN-000737-T8 for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 04:54:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9ulE-0004xF-Fl for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 04:54:25 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:38607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9ulE-0004x3-8A for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 04:54:16 -0500 Received: by mail-pb0-f46.google.com with SMTP id uo15so1594457pbc.19 for ; Mon, 25 Feb 2013 01:54:15 -0800 (PST) In-Reply-To: <87wqtxfjpb.fsf@Rainer.invalid> (Achim Gratz's message of "Sun, 24 Feb 2013 23:09:04 +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 twisted the bytes to say: Achim> D M German writes: >> There are some bugs. For example, the interpretation of :results table, >> vector and list. Achim> You may misunderstand some things, or I don't understand what you are Achim> asking. It is (at least currently) the responsibility of the Perl Achim> program (or any other Babel language) to deliver the result in such a Achim> way that it can be interpreted correctly by the result type chosen (in Achim> other word, the program output must be valid Org syntax in the given Achim> context). You can't have the same program produce tables, vectors and Achim> LaTeX output just by switching the results type. I understand. But what I want is the output to be wrapped accordingly, and my script to deliver exactly the output as expected. So say I want to generate HTML in my script, I can use :results output, but then I have to change to replace the #+being_example with #+begin_HTML. I guess that I can generate a two dimensional table with perl too using output (printing the necessary | and \n), but then it will be wrapped with #+begin_example. >> But I think the main problem comes from the way that Babel expects the >> result. In Babel, and except for :results output, the last expression in >> perl is considered the input to the results. Achim> That is with the default wrapper function, which expects the program to Achim> return something that either is a string or interpolates to a string Achim> that Babel can interpret. You can easily define one yourself that does Achim> different things, like simply open the output file then select the Achim> filehandle for output. That's what I'd do in any case and I think it Achim> would work just as you want. Perhaps a string can be the solution. Ok, I am testing: #+begin_src perl :results table ("a|b|c|\n|c|d|e") #+end_src #+RESULTS: | a | b | c | \n | c | d | e | Ok, this seems to be more useful that returning a list of values. Is there a way to separate two rows in the result? Thanks again Achim, --daniel -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .