use Exception::Class ( 'My::Exception' => { description => 'simple exception'}, ); My::Exception->Trace(1); # enable catching full traces eval { My::Exception->throw('Foo'); }; if ($@) { my $e = $@; $e->show_trace(1); warn $e->as_string; } #### use Exception::Class ( 'My::Exception' => { description => 'simple exception'}, ); My::Exception->Trace(1); # enable catching full traces eval { My::Exception->throw('Foo'); }; if (my $e = Exception::Class->caught('My::Exception')) { $e->show_trace(1); warn $e->as_string; }