diff options
| author | fukachan <fukachan> | 2001-02-28 01:47:54 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-02-28 01:47:54 +0000 |
| commit | 2ca3b4f53c109cb6b2ac29317fa98d838c05ab89 (patch) | |
| tree | 7d1264543ca437f82aff563dc8f7cd14df824451 /fml/lib | |
| parent | de534bd68533eb3b7da42690fdf112a22a969368 (diff) | |
| download | fml8-2ca3b4f53c109cb6b2ac29317fa98d838c05ab89.tar.gz fml8-2ca3b4f53c109cb6b2ac29317fa98d838c05ab89.tar.bz2 fml8-2ca3b4f53c109cb6b2ac29317fa98d838c05ab89.zip | |
prototype of dynamic loading FML::Command::$command
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Process/Command.pm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm index 917f37d0..9dcba514 100644 --- a/fml/lib/FML/Process/Command.pm +++ b/fml/lib/FML/Process/Command.pm @@ -86,6 +86,8 @@ sub finish } +# dynamic loading of command definition. +# It resolves your customized command easily. sub _evaluate_command { my ( $curproc ) = @_; @@ -93,10 +95,14 @@ sub _evaluate_command my $body = $curproc->{ incoming_message }->{ body }->get_content_body; my @body = split(/\n/, $body); - for (@body) { - my $valid = $config->has_attribute( "available_commands", $_ ) - ? "valid" : "invalid"; - Log("command($valid) = " . $_); + for my $command (@body) { + my $is_valid = + $config->has_attribute( "available_commands", $command ) + ? 'yes' : 'no'; + Log("command = " . $command . " (valid?=$is_valid)"); + next if $is_valid eq 'no'; + eval qq{ require FML::Command::$command; }; + if ($@) { Log($@);} } } |
