[Israel.pm] Redirecting duplicated STDOUT from child proccess to parent

Peter Gordon peter at pg-consultants.com
Tue Feb 19 22:43:53 PST 2008


You could try something like this.

my $tty = `tty` ;
chomp $tty ;
open(F,">$tty") ;
print F "HI THERE\n" ;
print "HELLO\n" ;



On Wed, 2008-02-20 at 08:01 +0200, Erez David wrote:
> Hi,
> 
> I am redirecting child's STDOUT to its parent with the following line:
> open(STDOUT, ">&=PUTSTDOUT") || croak("Couldn't redirect STDOUT: $!");
>     # PUTSTDOUT is a pipe to the parent.
> 
> Though, I would still like the child's STDOUT to bee written to the
> screen and not only be redirected to its parent.
> 
> I have tried to use File::Tee module:
> Use File::Tee qw(tee);
> tee(STDOUT, '>&',  'PUTSTDOUT');
> 
> But it didn't work and the STDOUT wasn't piped to the parent process.
> 
> Any idea how can I do it?
> 
> 
> Thanks
> Erez
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list