summaryrefslogtreecommitdiff
path: root/fml/libexec
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-01-29 04:32:34 +0000
committerfukachan <fukachan>2001-01-29 04:32:34 +0000
commit1b3a879cf3fc9dee8d23fe452060953c3ff8adf6 (patch)
tree72852a294243f6e4c277481b89f937b29c83d092 /fml/libexec
parent221ff1e67b47a843c3f5209803da0daa35506f3b (diff)
downloadfml8-1b3a879cf3fc9dee8d23fe452060953c3ff8adf6.tar.gz
fml8-1b3a879cf3fc9dee8d23fe452060953c3ff8adf6.tar.bz2
fml8-1b3a879cf3fc9dee8d23fe452060953c3ff8adf6.zip
change hierarchy of routines. The current flow is as follows:
loader -> process_switch -> FML::Process::Flow -> each process 1. loader resolves version dependence 2. process_switch loads requred package 3. main::ProcessStart() (exporeted to main:: at FML::Process::Flow) controlls flow. 4. details of each flow is described in FML::Process::Something et. al.
Diffstat (limited to 'fml/libexec')
-rwxr-xr-xfml/libexec/loader52
-rwxr-xr-xfml/libexec/process_switch97
2 files changed, 77 insertions, 72 deletions
diff --git a/fml/libexec/loader b/fml/libexec/loader
index 3998f2b7..d26d129c 100755
--- a/fml/libexec/loader
+++ b/fml/libexec/loader
@@ -4,7 +4,7 @@
# Copyright (C) 2000-2001 Ken'ichi Fukamachi
# All rights reserved.
#
-# $Id: loader,v 1.1 2001/01/29 03:18:14 fukachan Exp $
+# $Id: loader,v 1.2 2001/01/29 03:23:41 fukachan Exp $
# $FML$
#
@@ -34,10 +34,14 @@ BEGIN {
# Descriptions: top lebel bootstrap program
-# which load the required library and switch myself to it.
-# loading order:
-# libexec/loader -> libexec/process_switch -> FML::Process::Something
+# which load a dispather program (process_switch)
+# for process switch. The flow of execution follows:
+# libexec/loader ->
+# libexec/process_switch ->
+# FML::Process::Something
# Arguments: none
+# XXX this program sees $0
+# (program name, == argv[0] of C language)
# Side Effects: switch to the real process
# Return Value: none
sub Bootstrap
@@ -96,18 +100,25 @@ sub Bootstrap
# 5. o.k. here we go!
if (-f "$libexec_dir/process_switch") {
+ my ($args, $pkg);
+
+ $args = {
+ fml_version => $main_cf->{ fml_version },
+
+ myname => $myname,
+ ml_home_prefix => $main_cf->{ ml_home_prefix },
+ ml_home_dir => $ml_home_dir,
+
+ cf_list => \@cf,
+ options => \%options,
+ };
+
+ # See libexec/process_switch on ProcessSwitch()
require "$libexec_dir/process_switch";
- ProcessSwitch(
- {
- fml_version => $main_cf->{ fml_version },
+ $pkg = ProcessSwitch($args);
- myname => $myname,
- ml_home_prefix => $main_cf->{ ml_home_prefix },
- ml_home_dir => $ml_home_dir,
-
- cf_list => \@cf,
- options => \%options,
- });
+ # See FML::Process::Kernel module on ProcessStart()
+ ProcessStart($pkg, $args);
}
else {
croak("$libexec_dir/fml is not found.");
@@ -121,10 +132,21 @@ loader -- the wrapper which executes a real fml5 program.
=head1 SYNOPSIS
-loader C<[-c main.cf]> C<[--debug]> C<[--ctladdr]> ml_home_dir
+loader C<[-c main.cf]> C<[--debug]> C<[--ctladdr]> [ml_home_dir]
=head1 DESCRIPTION
+The loader resolves fml version dependence.
+It checks /etc/fml/main.cf and prepare @INC for some fml version.
+The real process switch routine is dependent on fml version.
+
+C<libexec/fml/loader> switches itself to a program specified by $0.
+C<libexec/fml/$VERSION/process_switch> analyzes several conditions
+specified by main.cf, @INC and $0 et. al.
+The swithing is done in libexec/fml/$VERSION/process_switch.
+See C<libexec/fml/$VERSION/process_switch> for more details on process
+switching.
+
C<-c main.cf>
main.cf alternative
diff --git a/fml/libexec/process_switch b/fml/libexec/process_switch
index f7989d95..b7a7b413 100755
--- a/fml/libexec/process_switch
+++ b/fml/libexec/process_switch
@@ -15,50 +15,36 @@ 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 ...
+# emulates "use $package" but $package is dynamically
+# determined by e.g. $0.
# Arguments: $args
# XXX non OO interface
-# Side Effects: process running :-)
-# Return Value: none
+# Side Effects: process switching :-)
+# ProcessSwtich() is exported to main:: Name Space.
+# Return Value: package name
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);
+ my $pkg = _module_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);
+ return $pkg;
}
# Descriptions: determine package we need and require() it if needed.
# Arguments: $args
# XXX non OO interface
-# Side Effects:
+# Side Effects: none
# Return Value: FML::Process::SOMETHING process object
-sub _package_we_use
+sub _module_we_use
{
my ($args) = @_;
my $name = $args->{ myname };
@@ -91,48 +77,45 @@ sub _package_we_use
}
-
=head1 NAME
-fml -- net/fml switch programs
+process_switch - switch or dispacther table to execute real fml programs
=head1 SYNOPSIS
- fml
+ require "$libexec_dir/process_switch";
+ ProcessSwitch(
+ {
+ fml_version => $main_cf->{ fml_version },
+
+ myname => $myname,
+ ml_home_prefix => $main_cf->{ ml_home_prefix },
+ ml_home_dir => $ml_home_dir,
+
+ cf_list => \@cf,
+ options => \%options,
+ });
+
+See also C<libexec/fml/loader>.
=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
+C<libexec/loader>
+(C<libexec/fml/loader>),
+the wrapper, loads this program and calls C<ProcessSwitch()>.
+C<ProcessSwitch()> emulates "use $package" for a program specified by
+the arguments.
+
+The details of each program exists in FML::Process:: class.
+
+=head1 SEE ALSO
+
+L<FML::Process::Distribute>,
+L<FML::Process::Command>,
+L<FML::Process::ListServer>,
+L<FML::Process::Configure>,
+L<FML::Process::TicketSystem>,
+L<FML::Process::MailErrorAnalyzer>
=cut