How to implement IPC with scalars?

E

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: 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
 
B

Ben Morrow

Quoth Eric said:
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
 
X

xhoster

Eric said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top