in reply to Capturing STDERR from a module
Use eval.
use SomeModule; my $foo = SomeModule->new; eval { $foo->die_die_die }; if ($@) { print "There was a problem, but we didn't die: $@"; } else { print "Not a problem."; }
As the code above suggests, eval will (usually) prevent the module from dieing and $@ will contain the error.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Capturing STDERR from a module
by Anonymous Monk on May 16, 2003 at 19:42 UTC |