diff options
| author | fukachan <fukachan> | 2004-11-23 13:36:59 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-11-23 13:36:59 +0000 |
| commit | a97e38114f7dd56d2537ea18db14be420901d0bf (patch) | |
| tree | 6821b4185633ce6fb3da6650a3a5ced3de108c82 /fml/lib/FML/Process | |
| parent | dd8009466d0918ce5f2da56555ace777040db7be (diff) | |
| download | fml8-a97e38114f7dd56d2537ea18db14be420901d0bf.tar.gz fml8-a97e38114f7dd56d2537ea18db14be420901d0bf.tar.bz2 fml8-a97e38114f7dd56d2537ea18db14be420901d0bf.zip | |
clean up.
Diffstat (limited to 'fml/lib/FML/Process')
| -rw-r--r-- | fml/lib/FML/Process/Emulate.pm | 111 |
1 files changed, 76 insertions, 35 deletions
diff --git a/fml/lib/FML/Process/Emulate.pm b/fml/lib/FML/Process/Emulate.pm index 48d55620..8919bbb2 100644 --- a/fml/lib/FML/Process/Emulate.pm +++ b/fml/lib/FML/Process/Emulate.pm @@ -3,7 +3,7 @@ # Copyright (C) 2004 Ken'ichi Fukamachi # All rights reserved. # -# $FML$ +# $FML: Emulate.pm,v 1.1 2004/11/23 04:24:16 fukachan Exp $ # package FML::Process::Emulate; @@ -81,43 +81,84 @@ sub prepare $curproc->fix_perl_include_path(); $curproc->scheduler_init(); $curproc->log_message_init(); + $curproc->_fml4_emulate(); +} + + +# Descriptions: emulate fml4 (fml.pl in fact) process. +# Arguments: OBJ($curproc) +# Side Effects: none +# Return Value: none +sub _fml4_emulate +{ + my ($curproc) = @_; + my $option = $curproc->command_line_options || {}; + + if (defined $option->{ ctladdr } && $option->{ ctladdr }) { + $curproc->_fml4_emulate_command_mail_process(); + } + else { + $curproc->_fml4_emulate_post_article_process(); + } +} + + +# Descriptions: emulate fml4 (fml.pl in fact) process. +# Arguments: OBJ($curproc) +# Side Effects: none +# Return Value: none +sub _fml4_emulate_post_article_process +{ + my ($curproc) = @_; + my $config = $curproc->config(); + + $curproc->log("start as article_post mode"); + + eval q{ + use FML::Process::Distribute; + unshift(@ISA, "FML::Process::Distribute"); + }; + if ($@) { + $curproc->logerror($@); + croak("failed to initialize article_post process."); + } + + if ($config->yes('use_article_post_function')) { + $curproc->parse_incoming_message(); + } + else { + $curproc->logerror("use of distribute program prohibited"); + exit(0); + } +} + + +# Descriptions: emulate fml4 (fml.pl in fact) process. +# Arguments: OBJ($curproc) +# Side Effects: none +# Return Value: none +sub _fml4_emulate_command_mail_process +{ + my ($curproc) = @_; + my $config = $curproc->config(); + + $curproc->log("start as command_mail mode"); + + eval q{ + use FML::Process::Command; + unshift(@ISA, "FML::Process::Command"); + }; + if ($@) { + $curproc->logerror($@); + croak("failed to initialize command_mail process."); + } - my $a = $curproc->command_line_options || {}; - if (defined $a->{ ctladdr } && $a->{ ctladdr }) { - $curproc->log("start as command_mail mode"); - - eval q{ - use FML::Process::Command; - unshift(@ISA, "FML::Process::Command"); - }; - $curproc->logerror($@) if $@; - croak("failed to initialize command_mail process.") if $@; - - if ($config->yes('use_command_mail_function')) { - $curproc->parse_incoming_message(); - } - else { - $curproc->logerror("use of command_mail program prohibited"); - exit(0); - } + if ($config->yes('use_command_mail_function')) { + $curproc->parse_incoming_message(); } else { - $curproc->log("start as article_post mode"); - - eval q{ - use FML::Process::Distribute; - unshift(@ISA, "FML::Process::Distribute"); - }; - $curproc->logerror($@) if $@; - croak("failed to initialize article_post process.") if $@; - - if ($config->yes('use_article_post_function')) { - $curproc->parse_incoming_message(); - } - else { - $curproc->logerror("use of distribute program prohibited"); - exit(0); - } + $curproc->logerror("use of command_mail program prohibited"); + exit(0); } } |
