Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Re: Best Way to Redirect STDERR to a Scalar

by davido (Archbishop)
on Sep 14, 2003 at 01:06 UTC ( #291325=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Best Way to Redirect STDERR to a Scalar
in thread Best Way to Redirect STDERR to a Scalar

I don't know that it's correct or safe to jump to the conclusion that Tie::STDERR won't do what's needed, as the OP didn't specify in his original post that he was trying to catch errors that come from executing external commands.

Tie::STDERR will allow you to redirect any errors that come from Perl or Perl commands, but not from external (such as system() or `` backticks). It will even catch Perl's compiler errors, though as the POD states, the errors that it reports from the compiler aren't what you might expect to see.

So if you're trying to redirect the output from any Perl-generated errors, or errors that you generate internally in your script, Tie::STDOUT works great. But if you want to redirect external command errors, you'll have to dig deeper.

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein


Comment on Re: Re: Re: Best Way to Redirect STDERR to a Scalar
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-12-26 14:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls