Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Re: Re: capturing STDERR within a script

by RhetTbull (Curate)
on Mar 30, 2003 at 03:31 UTC ( #246681=note: print w/replies, xml ) Need Help??

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

What version of perl are you using? I just tried the above example with perl 5.8.0 on cygwin and it displayed the behavior that you stated -- @errors was empty. This is the first time I've noticed this. A different Filter::Handle snippet caused 5.8.0 to coredump. I wonder if it's a bug in perl or a bug in Filter::Handle that broke with perl 5.8.0. Anyone else have any luck running Filter::Handle with perl >= 5.8.0?
  • Comment on Re: Re: Re: capturing STDERR within a script

Replies are listed 'Best First'.
Re: Re: Re: Re: capturing STDERR within a script
by bart (Canon) on Mar 30, 2003 at 12:30 UTC
    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://246681]
[erix]: my app (google, really) makes that 1530 km...
[Eily]: google tells me 1662 km ...
[LanX]: Nancy? Somewhere near Metz ...
[Eily]: must be km farenheit or something :P
[Eily]: wow, don't say that in Nancy LanX :P
[erix]: maybe you used the car routes, I used the walking routes
[Eily]: there's a rivalry between the two cities, so defining one in terms of the other might not be well received
[Eily]: erix well I did click on the walking icon
LanX giggles!
[LanX]: Eily I'm duing this constantly with people from rival cities ...MUCHO fun!

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-12-13 15:20 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (369 votes). Check out past polls.