Click here to get back home

pipe for stderr and stdout

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
pipe for stderr and stdout Ivan Novick 03-26-2008
Posted by Ivan Novick on March 26, 2008, 7:17 pm
Please log in for more thread options
Hi,

From within perl i want to start a first process 'A' which writes to
both STDOUT and STDERR.

From the same perl script i want to start 2 more processes.

One, 'B', that reads from STDOUT of 'A"

The other, 'C', that reads from STDERR 'A'

Is this possible from within perl?

Thanks,
Ivan Novick
http://www.myperlquiz.com/

Posted by Gunnar Hjalmarsson on March 26, 2008, 8:33 pm
Please log in for more thread options
Ivan Novick wrote:
> From within perl i want to start a first process 'A' which writes to
> both STDOUT and STDERR.
>
> From the same perl script i want to start 2 more processes.
>
> One, 'B', that reads from STDOUT of 'A"
>
> The other, 'C', that reads from STDERR 'A'
>
> Is this possible from within perl?

Yes.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Ivan Novick on March 26, 2008, 10:28 pm
Please log in for more thread options
> Ivan Novick wrote:
> > From within perl i want to start a first process 'A' which writes to
> > both STDOUT and STDERR.
>
> > From the same perl script i want to start 2 more processes.
>
> > One, 'B', that reads from STDOUT of 'A"
>
> > The other, 'C', that reads from STDERR 'A'
>
> > Is this possible from within perl?
>
> Yes.
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl

How about a hint as to how?

Ivan Novick
http://www.myperlquiz.com/

Posted by Gunnar Hjalmarsson on March 26, 2008, 11:49 pm
Please log in for more thread options
Ivan Novick wrote:
>> Ivan Novick wrote:
>>> From within perl i want to start a first process 'A' which writes to
>>> both STDOUT and STDERR.
>>> From the same perl script i want to start 2 more processes.
>>> One, 'B', that reads from STDOUT of 'A"
>>> The other, 'C', that reads from STDERR 'A'
>>> Is this possible from within perl?
>>
>> Yes.
>
> How about a hint as to how?

I'm not able to tell you any details, but I'd study "perldoc perlipc"
and "perldoc perlfork" and start playing with code.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Ted Zlatanov on March 27, 2008, 10:16 am
Please log in for more thread options

IN> From within perl i want to start a first process 'A' which writes to
IN> both STDOUT and STDERR.

IN> From the same perl script i want to start 2 more processes.

IN> One, 'B', that reads from STDOUT of 'A"

IN> The other, 'C', that reads from STDERR 'A'

IN> Is this possible from within perl?

I believe it's possible with IPC::Run, which has pretty much every way
of running a program and capturing its output I ever needed. I can't
give you the exact solution but you'll see very relevant examples in the
first pages of the module's documentation (especially feeding one
child's output to another). You can install IPC::Run from CPAN.

Ted

Similar ThreadsPosted
How to redirect STDOUT &STDERR? August 4, 2004, 3:21 am
selecting STDOUT AND STDERR December 20, 2004, 1:59 pm
splitting stderr/stdout without using file April 27, 2006, 7:22 am
redirecting stdout/stderr to logfile May 24, 2006, 9:59 pm
WinNT ActiveState STDERR and STDOUT August 24, 2006, 11:35 pm
daemonizing a process AND capture stdout, stderr January 14, 2005, 8:00 pm
Take over STDOUT / STDERR for Perl embedded in C application October 4, 2005, 5:43 pm
STDOUT and STDERR redirection fails for forked process July 19, 2007, 4:06 am
STDOUT and STDERR redirection fails for forked process July 19, 2007, 6:09 am
script hangs when run from command line and redirecting stdout and stderr to file January 5, 2006, 12:59 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap