use Try::Tiny; use Exception::Class ( 'MyException', 'Commands' => { isa => 'MyException' }, 'Timeout' => { isa => 'Commands', description => 'These exceptions are resulted from running the naviseccli commands' } ); try{ MyException->throw( error => 'I feel funny. custom string based on error' ) ; } catch{ my $e=$_; if ( $e == Exception::Class->caught('MyException') ) { warn $e->error, "\n", $e->trace->as_string, "\n"; warn join ' ', $e->euid, $e->egid, $e->uid, $e->gid, $e->pid, $e->time; #exit; } };