James,
I tried this out but couldn't get it to work. $@ wasn't set when the END block was called.
The good news is if we are in an eval block, exception_handler::die can call Carp::croak[1]. Which "dies of errors (from perspective of caller)".
- Alex
[1] http://perldoc.perl.org/Carp.html
On Nov 30, 2006, at 4:27 PM, James Edward Gray II wrote:
On Nov 30, 2006, at 6:07 PM, Hans-Joerg Bibiko wrote:
Alex,
The the reason we don't want to handle errors that were throw in eval blocks is the reason you mentioned. Typically, the user handles the error themself. But it is bad that $@ refers to exception_handler.pm line 34 after a die. I think we can fix this somehow.
Try the attached exception_handler.pm.
Hmm, can't Perl exception catching be done the way we do it in Ruby? My Perl is rusty but a close translation would be something like the following (I think):
END { if ($@) { # we are exiting with an exception here... } }
James Edward Gray II
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate