... my $method = $dispatch{ $command }; $self->$method( ); ...
Or you can be more bullet proof.
my $method = $self->can( $dispatch( $command ) ); unless( defined $method ) { warn "I don't understand `$command'\n"; return; } $self->$method( );
In reply to Re: Dispatching Method Objects
by Fletch
in thread Dispatching Method Objects
by ehdonhon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |