in reply to Dispatch table within package question
It's not directly possible. However, this is:
my %handler_for = ( type1 => 'sub1', type2 => 'sub2', ); my $handler = $handler_for{ $type }; $self->$handler( $var );
Depending on the scope of your problem you should derive a class for each handler, though, and let the method dispatch take care of this.
Makeshifts last the longest.
|
|---|