Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Please Help!
August 1, 2006, 12:03 pm
rate this thread
with this module is apart from using a log it also prints certain
errors directly to STDERR.
I want to catch these errors being printed to STDERR and log it into my
Since this module is an API I cannot change it's log config.
How to use eval and $SIG to workaround this problem ? Or are
there any other solutions ?
Kindly guide me on this,
Re: Please Help!
If it is really printing directly to STDERR then you can't. If it uses
warn/die then you can use $SIG/eval to catch the errors, but
you already knew that so I presume it isn't :).
Open STDERR onto a string, like this:
open STDERR, '>', $STDERR_LOG or die "can't catch STDERR: $!";
Note this requires 5.6(.1?) to work right.
Anything printed to STDERR will go into that string. You may want to dup
stderr somewhere else first, so's you can put it back afterwards.
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
Please Help - Problem solved !!!
HI Michele and Ben,
Thanks for your help.
I am still figuring out Michele's solution, as I am just an amateur to
I found this solution : Using IO::Capture::Stderr - check CPAN
This can capture stdin,stdout,stderr and so on. Hope this is of info to
Thanks once again,
- » Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
- — Previous thread in » PERL Discussions