[CMI.PM] block STDERR from a CPAN module implemented in C?
Milt Epstein
mepstein at uiuc.edu
Sat Nov 15 18:16:44 CST 2003
On Sat, 15 Nov 2003, Brandon Bowersox wrote:
> Since we've had such lively support lately...
>
> How can I trap or block STDERR output from the XML::GDOME module
> which is an XS module that uses a C implementation?
>
> Pretend Solution #1------------------------------------------
> close STDERR;
> XML::GDOME->foo; #call that generates STDERR
>
> Pretend Solution #2------------------------------------------
> local *STDERR;
> open (STDERR, ">".File::Spec->devnull());
> XML::GDOME->foo; #call that generates STDERR
>
> #1 works but stops me from getting any of the helpful output from any
> part of my program below. #2 does not work because the XML::GDOME
> calls are in a different scope where "local *STDERR" no longer
> applies.
[ ... ]
Did you try it without the "local *STDERR"? (You can save and restore
it before and after as needed -- there's an example on the perlfunc
man page.)
Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
mepstein at uiuc.edu
More information about the Champaign-Urbana
mailing list