Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Keep It Simple, Stupid
 
PerlMonks  

Answer: How can I tell at run time that my script is writing to STDERR?

( #207962=categorized answer: print w/ replies, xml ) Need Help??

Q&A > debugging > How can I tell at run time that my script is writing to STDERR? contributed by .tom.

What you can do to prevent anything from beeing to STDERR is close the file descriptor :
print STDERR "prints...\n"; close(STDERR); print STDERR "doesn't print...\n" or print "this was bound to fail\n";
But any entity that tries to write to STDERR will fail doing that, so you should also reopen STDERR to /dev/null to avoid that.
open(STDERR,'>/dev/null'); print STDERR "doesn't fail so this..." or print "...won't print";

Comment on Answer: How can I tell at run time that my script is writing to STDERR?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2013-05-26 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (524 votes), past polls