[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] evaluation of perl in babel
From: |
D M German |
Subject: |
Re: [O] evaluation of perl in babel |
Date: |
Mon, 25 Feb 2013 01:54:11 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
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 .