How to trap/handle all fatal conditions?
Brad Cox (bcox@gmu.edu)
Sun, 8 Sep 1996 17:37:41 -0400
Probably better asked on a general perl list but I don't belong to one.
I'm teaching large net-based class at http://www.virtualschool.edu/96c that
relies heavily on CGI. Want to direct all fatal conditions to one place to
mail stack backtraces and dump info so that I don't need to have newbies
read it to me on the phone (never works!). And possibly someday handle
exceptions by putting computations back on the rails.
The following seems to catch dies OK. It misses certain other fatals like
undefined message sends, etc. Is it possible to catch any and every error
condition in perl, even internal ones from the messager?
# bjc: Trap dies to aborts in order to get stack backtrace
sub BEGIN {
$SIG{__DIE__} = sub { abort(@_); };
}
sub abort { ... }
1;
Brad Cox; bcox@gmu.edu; 703 968-8229
GMU Program on Social and Organizational Learning
http://www.virtualschool.edu/mon Middle of Nowhere Web
A Project with Paradoxical Goals