. , , . can , - OO-ish, , , , .
, ) Perl, ( // , Perl // 5.10- "" , ") b) :
Module.pm
package Module;
use strict;
use warnings;
use 5.010;
our $function_lookup = {
FctInitEvaluate => \&init_evaluate,
FctInitExecute => \&init_execute,
};
sub init_evaluate {
say 'In init_evaluate';
}
sub init_execute {
say 'In init_execute';
}
1;
script.pl
use strict;
use warnings;
require Module;
execute_command('FctInitEvaluate', 'Some input');
execute_command('FctInitExecute', 'Some input');
sub execute_command {
my ($input_command, @arguments) = @_;
$Module::function_lookup->{$input_command}(@arguments)
if exists($Module::function_lookup->{$input_command});
}