Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Tidying up after redirecting STDERR

by crashtest (Curate)
on Feb 22, 2010 at 22:08 UTC ( #824719=note: print w/ replies, xml ) Need Help??


in reply to Tidying up after redirecting STDERR

Since I can't easily tell the two apart from the command prompt, I don't really how to be sure if anything I put in has worked.
Tell apart STDOUT and STDERR? Just redirect them to separate files:
perl yourscript.pl >stdout.txt 2>stderr.txt

Although I feel local'izing the file handles is cleaner, as suggested by JavaFan, you could alternatively store them. Then re-store them. That way, you'd have STDERR available in the block if you needed it.

my ($out, $err) = (*STDOUT, *STDERR); eval{ *STDERR = *STDOUT; # pod2html code here # ... }; *STDOUT = $out; *STDERR = $err;


Comment on Re: Tidying up after redirecting STDERR
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-08-21 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (128 votes), past polls