Bewarned about Error.pm. It has some nasty problems with closures, and I've decided to shy away from it, despite the fact that I happen to like Java-style exception handling. Personally, I go with Exception::Class, which doesn't give you the nice syntax that Error.pm does, but its good enough:
use Exception::Class ('MyException');
eval { # Pretend this says 'try'
MyException->throw( error => 'I feel funny.';
};
if( UNIVERSAL::isa( $@, 'MyException' ) ) { # Pretend this says 'catc
+h MyException'
warn $@->error, "\n, $@->trace->as_string, "\n";
warn join ' ', $@->euid, $@->egid, $@->uid, $@->gid, $@->pid, $@
+->time;
exit;
}
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated