Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Forks, Pipes and Exec (file descriptors)

by almut (Canon)
on Oct 29, 2008 at 23:14 UTC ( [id://720360]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    printf STDERR "before: fileno(STDOUT)=%d\n", fileno(STDOUT);
    
    ...
    pipe( $smash_stdout, STDOUT );
    
    printf STDERR "after:  fileno(STDOUT)=%d\n", fileno(STDOUT);
    
  2. or download this
    before: fileno(STDOUT)=1
    after:  fileno(STDOUT)=6
    
  3. or download this
    printf STDERR "before: fileno(STDOUT)=%d\n", fileno(STDOUT);
    
    ...
    open STDOUT, ">&WH" or die "open: $!";
    
    printf STDERR "after:  fileno(STDOUT)=%d\n", fileno(STDOUT);
    
  4. or download this
    before: fileno(STDOUT)=1
    after:  fileno(STDOUT)=1
    
  5. or download this
    open $old_stdout, ">&STDOUT" or die "open: $!";
    local(*RH, *WH);
    ...
    my $out = <RH>;
    
    print STDERR "got from pipe: $out";   # $out is "foobar\n"
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://720360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found