I\'ve noticed that Exception.pm and Error.pm don\'t seem to be extensively used in the Perl community. Is that due to the large footprint of eval for exception
As it has been mentioned you can use the traditional way with eval, but if you want to use more elaborate exception trapping, including with exception objects, then I recommend using the try-catch-finally blocks. There are quite a few perl modules that provide it such as Nice::Try and Syntax::Keyword::Try, but Syntax::Keyword::Try does not provide exception variable assignment or exception class catch like
try
{
# something
}
catch( Exception $e )
{
# catch this in $e
}
Full disclosure: I am the developer of Nice::Try