Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: redirect STDOUT from system() function

by snax (Hermit)
on Aug 10, 2001 at 13:46 UTC ( [id://103813]=note: print w/replies, xml ) Need Help??


in reply to redirect STDOUT from system() function

OK, so you say it's SUID. Be sure to clean up some environment variables:
$ENV{PATH}=''; $ENV{IFS}='';
With no PATH you have to explicitly give the entire path to system calls and so forth, but you're doing that anyway.

Now I can suggest the way I normally play with STDOUT:

open LS, qq(/bin/ls -al|) || die qq(cannot execute /bin/ls: $!); while (<LS>) { # Do whatever you want to do with STDOUT from # the ls call here } close LS;

This is basically straight out of perlipc.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-20 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found