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.
In reply to Re: switch question
by roboticus
in thread switch question
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |