in reply to switch question

morgon:

How about having a simple hash table then? Something like:

my %XMap = ( 'MyException::Class1'=>1, 'MyException::Class2'=>2, ... ); sub errorcode { my $ex = shift; my $type = ref $ex; return $XMap{$type} if exists $XMap{$type} return 3; # default }

...roboticus

When your only tool is a hammer, all problems look like your thumb.