How to implement IPC with scalars?

Discussion in 'Perl Misc' started by Eric, Sep 14, 2007.

  1. Eric

    Eric Guest

    Hey newsgroup,

    first of all, sorry for double-posting but I guess the subject of my
    last post was perhaps not hitting the spot or so... It can be found
    here: http://groups.google.de/group/comp....8f488/37ab354f1af7b6e7?hl=de#37ab354f1af7b6e7

    The main problem is that while pump()ing a child's output into my $out
    scalar, new output is not fed sequentially, so I always get back the
    entire output the program gave since it started.
    Any ideas? Please, I really need this stuff. I can't find any examples
    on the net apart from those in perlicp, which aren't explained in
    great detail..

    Thanks,
    Eric
     
    Eric, Sep 14, 2007
    #1
    1. Advertising

  2. Eric

    Ben Morrow Guest

    Quoth Eric <>:
    > Hey newsgroup,
    >
    > first of all, sorry for double-posting but I guess the subject of my
    > last post was perhaps not hitting the spot or so... It can be found
    > here:

    <deleted long URL>

    Please don't do this: either continue the thread, or start a new thread
    explaining from the beginning what you are talking about.

    > The main problem is that while pump()ing a child's output into my $out
    > scalar, new output is not fed sequentially, so I always get back the
    > entire output the program gave since it started.


    Read the docs for IPC::Run, in particular the example in the section
    "Using regexps to match output".

    Ben
     
    Ben Morrow, Sep 14, 2007
    #2
    1. Advertising

  3. Eric

    Guest

    Eric <> wrote:
    > Hey newsgroup,
    >
    > first of all, sorry for double-posting but I guess the subject of my
    > last post was perhaps not hitting the spot or so... It can be found
    > here:
    > http://groups.google.de/group/comp.lang.perl.misc/browse_thread/thread/
    > 4f c35c6fa1a8f488/37ab354f1af7b6e7?hl=de#37ab354f1af7b6e7


    You said that pipes didn't work, but you didn't say what the problem
    was. You posted code that doesn't run under use strict. And you framed
    the whole thing in the context of some other program that I (and
    presumably many other people) have never heard of and have little interest
    in, rather than in terms of Perl IPC.

    >
    > The main problem is that while pump()ing a child's output into my $out
    > scalar, new output is not fed sequentially, so I always get back the
    > entire output the program gave since it started.


    Yes, that is what IPC::Run does when it is used in this way. However, it
    doesn't seem to care if you screw around with the scalars in the mean time,
    so you could try clearing it before calling pump again:
    $out='';
    (This doesn't seem to be documented in IPC::Run, but I haven't studied that
    whole morass carefully.)

    But you if you using regex, you probably can't do this exactly, as a
    message that spans the buffer would never get found, you have have to clear
    only up to the full match, leaving the incomplete nascent message there.

    > Any ideas? Please, I really need this stuff. I can't find any examples
    > on the net apart from those in perlicp, which aren't explained in
    > great detail..


    We are not likely to re-write an entire perldoc section based on such
    vague complaints. If you have specific questions, please ask. Perhaps
    we can explain them to you, as well as improve the docs.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    The costs of publication of this article were defrayed in part by the
    payment of page charges. This article must therefore be hereby marked
    advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    this fact.
     
    , Sep 14, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Gardener

    Inheriting scalars

    Ray Gardener, Jun 9, 2004, in forum: C++
    Replies:
    7
    Views:
    431
    Ray Gardener
    Jun 10, 2004
  2. Replies:
    8
    Views:
    328
    Paul Boddie
    Mar 1, 2005
  3. ago
    Replies:
    3
    Views:
    329
  4. Replies:
    2
    Views:
    9,064
    Steve Holden
    Feb 28, 2008
  5. Jeff Thies

    scalars and namespace

    Jeff Thies, Jun 27, 2003, in forum: Perl Misc
    Replies:
    4
    Views:
    90
    Kent Paul Dolan
    Jun 28, 2003
Loading...

Share This Page