Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: How do I redirect STDERR to a subroutine?

by DaWolf (Curate)
on Feb 18, 2004 at 15:02 UTC ( [id://329925]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I redirect STDERR to a subroutine?
in thread How do I redirect STDERR to a subroutine?

You've said: "Messing with the standard streams should be your last resort."

I've had a a question about STDERR not long ago, so I'm curious: could you explain why it should be the last resort?

For an example, if my perl program runs in a Win32 environment without a DOS box, unless I "mess" with STDERR and put it into a file, I'd never see any errors generated by perl... So, you can say messing with STDERR was my first resort ;)

Thanks,

my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");
  • Comment on Re: Re: How do I redirect STDERR to a subroutine?

Replies are listed 'Best First'.
Re: Re: Re: How do I redirect STDERR to a subroutine?
by stvn (Monsignor) on Feb 18, 2004 at 16:08 UTC
    TMTOWTDI ... and ... Good advice is not always cross-platform. :)
Re: Re: Re: How do I redirect STDERR to a subroutine?
by samtregar (Abbot) on Feb 18, 2004 at 19:27 UTC
    I don't know much about Win32, but it sounds like STDERR is broken there. On Linux STDERR is virtually never broken unless you break it yourself. And if you do, there'll be hell to pay. Not too long ago I helped a co-worker track down a very difficult bug; in the end it turned out that he'd effectively closed STDERR and wasn't seeing the simple error message that would have helped him find the problem.

    -sam

      Sorry, but I have to disagree again.

      STDERR, AFAIK, is working perfectly on ActivePerl 5.8.0 on my Win2k box. The app I've mentioned writes to a log file and I get all sorts of error when things go wrong.

      I know Windows isn't perfect (at all) but people should have a little more faith on things running on it, instead of expecting them to go wrong just because it's a Win32 environment... Please, don't get me wrong, I don't mean to be rude, but I think any generalization is bad.

      I agree with you when you say that STDERR shouldn't be "muted", but then again neither I or the OP were suggesting this (if I ever do please kill me), we just want to redirect STDERR so we can treat it before displaying it, if I understood him correctly.

      Background: When I say "we" referring to me and the OP, it's because of my node: Formatting STDERR.

      Best regards,

      my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-23 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found