in reply to Re: Re: Exception handling (alternatives)
in thread Exception handling (alternatives)

You can catch normal die stuff with Error. I used it to catch DBI errors with the RaiseError flag on.

try { die "foobar"; } catch Error with { my $error = shift; print "failed: $error\n"; exit; }; print "ok";

Make sure you don't leave off the last semi-colon after the catch block, or it won't work.