Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
P is for Practical
 
PerlMonks  

Re: redirect STDOUT from system() function

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.