kiat has asked for the wisdom of the Perl Monks concerning the following question:
I'm wondering if there's a way to trap both fatal and non-fatal errors occurring in an entire module as it's being loaded by the calling script.
When'CGI::Carp qw(fatalsToBrowser)' is enabled, the error goes to the broswer, which is desirable during production development.
However, when 'CGI::Carp qw(fatalsToBrowser)' is disabled during production and an error occurs in one of the subs in the module, the script died with a '500 Internal Server Error'.
Is there a way to trap that error so that the unhelpful '500 Internal Server Error' can be prevented? Do you have to wrap each sub that's called with an 'eval' and then check for the value held in $@?
Thanks in advance!
Update: Edited the word 'production' to become 'development'. Thanks to dragonchild!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trap errors in entire module...
by matija (Priest) on Mar 28, 2004 at 09:27 UTC | |
by kiat (Vicar) on Mar 28, 2004 at 09:42 UTC | |
by matija (Priest) on Mar 28, 2004 at 09:45 UTC | |
by kiat (Vicar) on Mar 28, 2004 at 10:16 UTC | |
|
Re: Trap errors in entire module...
by dragonchild (Archbishop) on Mar 28, 2004 at 16:20 UTC | |
|
Re: Trap errors in entire module...
by Anonymous Monk on Mar 29, 2004 at 14:14 UTC |