sub exception (;$) { my $wanted_exception = shift; return unless $@; return 1 unless defined $wanted_exception; return ref($@) && $@->isa( $wanted_exception ) };