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)
In reply to Re: Capturing STDERR from a module
by Ovid
in thread Capturing STDERR from a module
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |