in reply to Dispatching Method Objects
... 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( );
|
|---|