From: D M German <dmg@uvic.ca>
To: emacs-orgmode@gnu.org
Subject: Re: evaluation of perl in babel
Date: Mon, 25 Feb 2013 01:54:11 -0800 [thread overview]
Message-ID: <87zjysu3b0.fsf@mn.cs.uvic.ca> (raw)
In-Reply-To: <87wqtxfjpb.fsf@Rainer.invalid> (Achim Gratz's message of "Sun, 24 Feb 2013 23:09:04 +0100")
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 .
next prev parent reply other threads:[~2013-02-25 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-24 21:08 evaluation of perl in babel D M German
2013-02-24 21:25 ` dmg
2013-02-24 22:09 ` Achim Gratz
2013-02-25 9:54 ` D M German [this message]
2013-02-25 9:57 ` dmg
2013-02-25 14:11 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjysu3b0.fsf@mn.cs.uvic.ca \
--to=dmg@uvic.ca \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).