From c6e709a215faee2be11e4340adede225b9ca0d73 Mon Sep 17 00:00:00 2001 From: fukachan Date: Mon, 29 Jan 2001 03:10:47 +0000 Subject: renamed from fml to process_switch --- fml/libexec/fml | 139 --------------------------------------------- fml/libexec/process_switch | 139 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 139 deletions(-) delete mode 100755 fml/libexec/fml create mode 100755 fml/libexec/process_switch (limited to 'fml/libexec') diff --git a/fml/libexec/fml b/fml/libexec/fml deleted file mode 100755 index 292e424d..00000000 --- a/fml/libexec/fml +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/local/bin/perl -w -#-*- perl -*- -# -# Copyright (C) 2000 Ken'ichi Fukamachi -# All rights reserved. -# -# $FML$ -# - -package FML; - -use vars qw($debug); -use strict; -use Carp; - - -# Descriptions: top level process switch -# 1. initialize processes and load configurations from *.cf -# switch to each process according with $0 and @ARGV. -# 2. parse the incoming message(mail) -# 3. start the main transaction -# lock, execute main routine, unlock -# 4. inform error messages, clean up and more ... -# Arguments: $args -# XXX non OO interface -# Side Effects: process running :-) -# Return Value: none -sub main::ProcessSwitch -{ - my ($args) = @_; - - # Firstly, create process - # $pkg is a package name, for exampl,e "FML::Process::Distribute". - my $pkg = _package_we_use($args); - croak("$args->{ myname } is unknown program\n") unless ($pkg); - - eval qq{ require $pkg; }; # XXX require() needs bare words. - croak($@) if $@; - $pkg->import(); # fake to use() method. - my $process = $pkg->new($args); # create a new process object - - # e.g. parse the incoming message (e.g. STDIN) - $process->prepare($args); - - # validate the request e.g. permit post from the sender ... - $process->verify_request($args); - - # start main transaction - $process->run($args); - - # closing the process - $process->finish($args); -} - - -# Descriptions: determine package we need and require() it if needed. -# Arguments: $args -# XXX non OO interface -# Side Effects: -# Return Value: FML::Process::SOMETHING process object -sub _package_we_use -{ - my ($args) = @_; - my $name = $args->{ myname }; - my $pkg = ''; - - if ($name eq 'fml.pl' || $name eq 'distribute' || $name eq 'fmlwrapper') { - $pkg = 'FML::Process::Distribute'; - } - elsif (( $name eq 'fml.pl' && $args->{ options }->{ ctladdr }) || - $name eq 'command') { - $pkg = 'FML::Process::Command'; - } - elsif ($name eq 'fmlserv') { - $pkg = 'FML::Process::ListServer'; - } - elsif ($name eq 'fmlconf' || $name eq 'makefml') { - $pkg = 'FML::Process::Configure'; - } - elsif ($name eq 'fmlticket') { - $pkg = 'FML::Process::TicketSystem'; - } - elsif ($name eq 'mead') { - $pkg = 'FML::Process::MailErrorAnalyzer'; - } - else { - return ''; - } - - return $pkg; -} - - - -=head1 NAME - -fml -- net/fml switch programs - -=head1 SYNOPSIS - - fml - -=head1 DESCRIPTION - -libexec/fml.pl, the wrapper, executes this program. For example, The -incoming mail to elena@fml.org kicks off libexec/distribute via -libexec/fml.pl, whereas mail to elena-ctl@fml.org kicks off -libexec/command finally. - - incoming_message => - elena@fml.org => fml.pl => libexec/distribute - elena-ctl@fml.org => fml.pl => libexec/command - elena-admin@fml.org => forwarded to administrator(s) - OR - => libexec/mead - -C<-d> - debug on. - -=head1 FLOW AROUND COMPONENTS - - | <=> FML::BaseSystem - | load configuration files - | start logging service - | - | STDIN => FML::Parse - | $CurProc->{'incoming_message'} <= - | $CurProc->{'credential'} - | - | (lock) - | prepare article - | $CurProc->{'article'} is spooled in. - | $CurProc->{'article'} <=> Service::SMTP - | (unlock) - V - -=cut - -1; diff --git a/fml/libexec/process_switch b/fml/libexec/process_switch new file mode 100755 index 00000000..292e424d --- /dev/null +++ b/fml/libexec/process_switch @@ -0,0 +1,139 @@ +#!/usr/local/bin/perl -w +#-*- perl -*- +# +# Copyright (C) 2000 Ken'ichi Fukamachi +# All rights reserved. +# +# $FML$ +# + +package FML; + +use vars qw($debug); +use strict; +use Carp; + + +# Descriptions: top level process switch +# 1. initialize processes and load configurations from *.cf +# switch to each process according with $0 and @ARGV. +# 2. parse the incoming message(mail) +# 3. start the main transaction +# lock, execute main routine, unlock +# 4. inform error messages, clean up and more ... +# Arguments: $args +# XXX non OO interface +# Side Effects: process running :-) +# Return Value: none +sub main::ProcessSwitch +{ + my ($args) = @_; + + # Firstly, create process + # $pkg is a package name, for exampl,e "FML::Process::Distribute". + my $pkg = _package_we_use($args); + croak("$args->{ myname } is unknown program\n") unless ($pkg); + + eval qq{ require $pkg; }; # XXX require() needs bare words. + croak($@) if $@; + $pkg->import(); # fake to use() method. + my $process = $pkg->new($args); # create a new process object + + # e.g. parse the incoming message (e.g. STDIN) + $process->prepare($args); + + # validate the request e.g. permit post from the sender ... + $process->verify_request($args); + + # start main transaction + $process->run($args); + + # closing the process + $process->finish($args); +} + + +# Descriptions: determine package we need and require() it if needed. +# Arguments: $args +# XXX non OO interface +# Side Effects: +# Return Value: FML::Process::SOMETHING process object +sub _package_we_use +{ + my ($args) = @_; + my $name = $args->{ myname }; + my $pkg = ''; + + if ($name eq 'fml.pl' || $name eq 'distribute' || $name eq 'fmlwrapper') { + $pkg = 'FML::Process::Distribute'; + } + elsif (( $name eq 'fml.pl' && $args->{ options }->{ ctladdr }) || + $name eq 'command') { + $pkg = 'FML::Process::Command'; + } + elsif ($name eq 'fmlserv') { + $pkg = 'FML::Process::ListServer'; + } + elsif ($name eq 'fmlconf' || $name eq 'makefml') { + $pkg = 'FML::Process::Configure'; + } + elsif ($name eq 'fmlticket') { + $pkg = 'FML::Process::TicketSystem'; + } + elsif ($name eq 'mead') { + $pkg = 'FML::Process::MailErrorAnalyzer'; + } + else { + return ''; + } + + return $pkg; +} + + + +=head1 NAME + +fml -- net/fml switch programs + +=head1 SYNOPSIS + + fml + +=head1 DESCRIPTION + +libexec/fml.pl, the wrapper, executes this program. For example, The +incoming mail to elena@fml.org kicks off libexec/distribute via +libexec/fml.pl, whereas mail to elena-ctl@fml.org kicks off +libexec/command finally. + + incoming_message => + elena@fml.org => fml.pl => libexec/distribute + elena-ctl@fml.org => fml.pl => libexec/command + elena-admin@fml.org => forwarded to administrator(s) + OR + => libexec/mead + +C<-d> + debug on. + +=head1 FLOW AROUND COMPONENTS + + | <=> FML::BaseSystem + | load configuration files + | start logging service + | + | STDIN => FML::Parse + | $CurProc->{'incoming_message'} <= + | $CurProc->{'credential'} + | + | (lock) + | prepare article + | $CurProc->{'article'} is spooled in. + | $CurProc->{'article'} <=> Service::SMTP + | (unlock) + V + +=cut + +1; -- cgit v1.2.1