Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Re: Re: capturing STDERR within a script

by bart (Canon)
on Mar 30, 2003 at 12:30 UTC ( #246724=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: capturing STDERR within a script
in thread capturing STDERR within a script

There's no need for you to just focus on 5.8.x — well, except for that coredump, of course... I've got a plain perl5.6.1 for Windows from Indigostar. That is a binary distribution which is virtually 100% compatible with Activeperl.

What I'd rather think is that the way the script is invoked, matters. I usually call scripts from within my text editor, and STDOUT/STDERR are captured by a tool program in order to display the result in an editor window. What's more, I redirect STDERR to STDOUT from withing perl, from withing a little module.

Aha. When I run it from the DOS prompt, without redirection, it works as you said it would. But when I add

open STDERR, ">&STDOUT";
to the top of the script, it fails.

The lesson to be learned is that capturing file handles, and maybe STDERR and STDOUT in particular, can be tricky if some redirecting has already been done on the handles before that.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2019-12-11 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?