summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-12-24 14:29:35 +0000
committerfukachan <fukachan>2003-12-24 14:29:35 +0000
commit3f16e20020bece5fbd22327d2cdf6c563367805b (patch)
treebc012cce2df70eb52af2475b5d20d346df1f9308
parent19551b386323e4acbc1629231ab7aed77222db3b (diff)
downloadfml8-3f16e20020bece5fbd22327d2cdf6c563367805b.tar.gz
fml8-3f16e20020bece5fbd22327d2cdf6c563367805b.tar.bz2
fml8-3f16e20020bece5fbd22327d2cdf6c563367805b.zip
remove the direct use of $args, use utility methods via $curproc
-rw-r--r--fml/lib/FML/Process/Addr.pm17
-rw-r--r--fml/lib/FML/Process/Alias.pm13
-rw-r--r--fml/lib/FML/Process/Calendar.pm6
-rw-r--r--fml/lib/FML/Process/ConfViewer.pm19
-rw-r--r--fml/lib/FML/Process/Digest.pm8
-rw-r--r--fml/lib/FML/Process/Distribute.pm8
-rw-r--r--fml/lib/FML/Process/DocViewer.pm21
-rw-r--r--fml/lib/FML/Process/Kernel.pm52
8 files changed, 73 insertions, 71 deletions
diff --git a/fml/lib/FML/Process/Addr.pm b/fml/lib/FML/Process/Addr.pm
index e39c89b3..c68a6c5a 100644
--- a/fml/lib/FML/Process/Addr.pm
+++ b/fml/lib/FML/Process/Addr.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Addr.pm,v 1.10 2003/08/23 07:24:45 fukachan Exp $
+# $FML: Addr.pm,v 1.11 2003/08/29 15:34:06 fukachan Exp $
#
package FML::Process::Addr;
@@ -119,7 +119,7 @@ sub verify_request
the top level dispatcher for C<fmladdr>.
-It kicks off C<_fmladdr($args)> for fmladdr.
+It kicks off C<_fmladdr()> for fmladdr.
NOTE:
C<$args> is passed from parrent libexec/loader.
@@ -139,7 +139,7 @@ sub run
my $myname = $curproc->myname();
my $argv = $curproc->command_line_argv();
- $curproc->_fmladdr($args);
+ $curproc->_fmladdr();
}
@@ -193,31 +193,30 @@ _EOF_
}
-=head2 _fmladdr($args)
+=head2 _fmladdr()
show all aliases (accounts + aliases).
show only accounts if -n option specified.
-See <FML::Process::Switch()> on C<$args> for more details.
-
=cut
# Descriptions: show all aliases (accounts + aliases).
# show only accounts if -n option specified.
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: load FML::Command::command module and execute it.
# Return Value: none
sub _fmladdr
{
- my ($curproc, $args) = @_;
+ my ($curproc) = @_;
my $config = $curproc->config();
my $eval = $config->get_hook( 'fmladdr_run_start_hook' );
if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; }
# show only accounts if -n option specified.
- my $mode = $args->{ options }->{ n } ? 'fmlonly' : 'all';
+ my $options = $curproc->command_line_options();
+ my $mode = $options->{ n } ? 'fmlonly' : 'all';
use FML::MTAControl;
my $mta = new FML::MTAControl;
diff --git a/fml/lib/FML/Process/Alias.pm b/fml/lib/FML/Process/Alias.pm
index b2352253..13ea9f04 100644
--- a/fml/lib/FML/Process/Alias.pm
+++ b/fml/lib/FML/Process/Alias.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Alias.pm,v 1.11 2003/08/23 07:24:46 fukachan Exp $
+# $FML: Alias.pm,v 1.12 2003/08/29 15:34:06 fukachan Exp $
#
package FML::Process::Alias;
@@ -133,7 +133,7 @@ sub run
my $myname = $curproc->myname();
my $argv = $curproc->command_line_argv();
- $curproc->_fmlalias($args);
+ $curproc->_fmlalias();
}
@@ -186,7 +186,7 @@ _EOF_
}
-=head2 _fmlalias($args)
+=head2 _fmlalias()
switch of C<fmlalias> command.
@@ -203,19 +203,20 @@ See <FML::Process::Switch()> on C<$args> for more details.
# Descriptions: fmlalias top level dispacher
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: load FML::Command::command module and execute it.
# Return Value: none
sub _fmlalias
{
- my ($curproc, $args) = @_;
+ my ($curproc) = @_;
my $config = $curproc->config();
my $eval = $config->get_hook( 'fmlalias_run_start_hook' );
if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; }
# show fmlonly aliases if -n option specified.
- my $mode = $args->{ options }->{ n } ? 'fmlonly' : 'all';
+ my $options = $curproc->command_line_options();
+ my $mode = $options->{ n } ? 'fmlonly' : 'all';
use FML::MTAControl;
my $mta = new FML::MTAControl;
diff --git a/fml/lib/FML/Process/Calendar.pm b/fml/lib/FML/Process/Calendar.pm
index e8bee1b2..44f121f1 100644
--- a/fml/lib/FML/Process/Calendar.pm
+++ b/fml/lib/FML/Process/Calendar.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Calendar.pm,v 1.5 2003/08/29 15:34:06 fukachan Exp $
+# $FML: Calendar.pm,v 1.6 2003/09/02 09:18:45 fukachan Exp $
#
package FML::Process::Calendar;
@@ -100,8 +100,8 @@ sub run
{
my ($curproc, $args) = @_;
my $config = $curproc->config();
- my $argv = $args->{ argv };
- my $option = $args->{ options };
+ my $argv = $curproc->command_line_raw_argv();
+ my $option = $curproc->command_line_options();
my $mode = 'text';
# -h or --help
diff --git a/fml/lib/FML/Process/ConfViewer.pm b/fml/lib/FML/Process/ConfViewer.pm
index f6af5ac9..88016885 100644
--- a/fml/lib/FML/Process/ConfViewer.pm
+++ b/fml/lib/FML/Process/ConfViewer.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: ConfViewer.pm,v 1.23 2003/08/24 14:12:18 fukachan Exp $
+# $FML: ConfViewer.pm,v 1.24 2003/08/29 15:34:07 fukachan Exp $
#
package FML::Process::ConfViewer;
@@ -123,7 +123,7 @@ sub verify_request
the top level dispatcher for C<fmlconf>.
-It kicks off internal function C<_fmlconf($args)> for C<fmlconf>.
+It kicks off internal function C<_fmlconf()> for C<fmlconf>.
NOTE:
C<$args> is passed from parrent libexec/loader.
@@ -149,7 +149,7 @@ sub run
$curproc->logwarn($@) if $@;
}
- $curproc->_fmlconf($args);
+ $curproc->_fmlconf();
$eval = $config->get_hook( 'fmlconf_run_end_hook' );
if ($eval) {
@@ -210,7 +210,7 @@ sub finish
}
-=head2 _fmlconf($args)
+=head2 _fmlconf()
run dump_variables of C<FML::Config>.
@@ -218,15 +218,16 @@ run dump_variables of C<FML::Config>.
# Descriptions: show configurations variables in the sytle "key = value".
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: none
# Return Value: none
sub _fmlconf
{
- my ($curproc, $args) = @_;
- my $config = $curproc->config();
- my $mode = $args->{ options }->{ n } ? 'difference_only' : 'all';
- my $argv = $curproc->command_line_argv();
+ my ($curproc) = @_;
+ my $config = $curproc->config();
+ my $options = $curproc->command_line_options();
+ my $mode = $options->{ n } ? 'difference_only' : 'all';
+ my $argv = $curproc->command_line_argv();
# if variable name is given, show the value.
if (defined $argv->[1]) {
diff --git a/fml/lib/FML/Process/Digest.pm b/fml/lib/FML/Process/Digest.pm
index 28cea281..c3d7b7de 100644
--- a/fml/lib/FML/Process/Digest.pm
+++ b/fml/lib/FML/Process/Digest.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Digest.pm,v 1.10 2003/08/23 15:33:14 fukachan Exp $
+# $FML: Digest.pm,v 1.11 2003/08/29 15:34:07 fukachan Exp $
#
package FML::Process::Digest;
@@ -157,7 +157,7 @@ sub run
$curproc->lock();
unless ($curproc->is_refused()) {
- $curproc->_digest($args);
+ $curproc->_digest();
}
else {
$curproc->logerror("ignore this request.");
@@ -222,12 +222,12 @@ sub finish
# Descriptions: primitive digest delivery.
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: update digest sequence.
# Return Value: none
sub _digest
{
- my ($curproc, $args) = @_;
+ my ($curproc) = @_;
use FML::Digest;
my $digest = new FML::Digest $curproc;
diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm
index 47fc84ae..74c14ff3 100644
--- a/fml/lib/FML/Process/Distribute.pm
+++ b/fml/lib/FML/Process/Distribute.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Distribute.pm,v 1.129 2003/11/29 10:24:28 fukachan Exp $
+# $FML: Distribute.pm,v 1.130 2003/11/30 09:59:19 fukachan Exp $
#
package FML::Process::Distribute;
@@ -421,16 +421,16 @@ sub _build_article_object
# Descriptions: header rewrite followed by
# $config->{ article_header_rewrite_rules }
# each method exists in FML::Header module.
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc) HASH_REF($hw_args)
# Side Effects: $curproc->{ article }->{ header } is rewritten
# Return Value: none
sub _header_rewrite
{
- my ($curproc, $args) = @_;
+ my ($curproc, $hw_args) = @_;
my $config = $curproc->config();
my $header = $curproc->article_message_header();
my $rules = $config->get_as_array_ref('article_header_rewrite_rules');
- my $id = $args->{ id };
+ my $id = $hw_args->{ id };
for my $rule (@$rules) {
$curproc->log("_header_rewrite( $rule )") if $config->yes('debug');
diff --git a/fml/lib/FML/Process/DocViewer.pm b/fml/lib/FML/Process/DocViewer.pm
index f5ee9c8b..df46a034 100644
--- a/fml/lib/FML/Process/DocViewer.pm
+++ b/fml/lib/FML/Process/DocViewer.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: DocViewer.pm,v 1.25 2003/08/23 07:24:47 fukachan Exp $
+# $FML: DocViewer.pm,v 1.26 2003/08/29 15:34:07 fukachan Exp $
#
package FML::Process::DocViewer;
@@ -133,17 +133,17 @@ sub run
my $myname = $curproc->myname();
my $argv = $curproc->command_line_argv();
- $curproc->_fmldoc($args);
+ $curproc->_fmldoc();
}
# Descriptions: fmldoc wrapper / top level dispacher
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc)
# Side Effects: none
# Return Value: none
sub _fmldoc
{
- my ($curproc, $args) = @_;
+ my ($curproc) = @_;
my $config = $curproc->config();
my $myname = $curproc->myname();
my $argv = $curproc->command_line_argv();
@@ -151,12 +151,13 @@ sub _fmldoc
my $eval = $config->get_hook( 'fmldoc_run_start_hook' );
if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; }
- my (@opts);
- push(@opts, '-v') if $args->{ options }->{ v };
- push(@opts, '-t') if $args->{ options }->{ t };
- push(@opts, '-u') if $args->{ options }->{ u };
- push(@opts, '-m') if $args->{ options }->{ m };
- push(@opts, '-l') if $args->{ options }->{ l };
+ my (@opts) = ();
+ my $options = $curproc->command_line_options();
+ push(@opts, '-v') if defined $options->{ v };
+ push(@opts, '-t') if defined $options->{ t };
+ push(@opts, '-u') if defined $options->{ u };
+ push(@opts, '-m') if defined $options->{ m };
+ push(@opts, '-l') if defined $options->{ l };
# add path for perl executatbles e.g. /usr/local/bin
eval q{
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index 4008549d..721a27cd 100644
--- a/fml/lib/FML/Process/Kernel.pm
+++ b/fml/lib/FML/Process/Kernel.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Kernel.pm,v 1.196 2003/11/29 14:32:03 fukachan Exp $
+# $FML: Kernel.pm,v 1.197 2003/12/06 04:48:20 fukachan Exp $
#
package FML::Process::Kernel;
@@ -629,7 +629,7 @@ sub resolve_ml_specific_variables
my ($ml_name, $ml_domain, $ml_home_prefix, $ml_home_dir);
my ($command, @options, $config_cf_path);
my $config = $curproc->config();
- my $myname = $args->{ myname };
+ my $myname = $curproc->myname();
my $ml_addr = '';
# XXX-TODO: $config should determine makefml like argument or not ?
@@ -719,7 +719,7 @@ sub resolve_ml_specific_variables
# Example: "| /usr/local/libexec/fml/fml.pl /var/spool/ml/elena"
# XXX the following code is true if config.cf has $ml_name definition.
else {
- my $r = $curproc->_find_ml_home_dir_in_argv($args->{ main_cf });
+ my $r = $curproc->_find_ml_home_dir_in_argv();
# [1.2.b.1]
# determine default $ml_home_dir and $hom_home_prefix by main.cf.
@@ -818,12 +818,12 @@ sub __debug_ml_xxx
# Descriptions: analyze argument vector and return ml_home_dir and .cf list.
-# Arguments: OBJ($curproc) HASH_REF($main_cf)
+# Arguments: OBJ($curproc)
# Side Effects: none
# Return Value: HASH_REF
sub _find_ml_home_dir_in_argv
{
- my ($curproc, $main_cf) = @_;
+ my ($curproc) = @_;
my $ml_home_prefix = $curproc->ml_home_prefix();
my $ml_home_dir = '';
my $found_cf = 0;
@@ -1358,12 +1358,12 @@ makefml not support message handling not yet.
# Descriptions: set reply message
-# Arguments: OBJ($curproc) OBJ($msg) HASH_REF($args)
+# Arguments: OBJ($curproc) OBJ($msg) HASH_REF($rm_args)
# Side Effects: none
# Return Value: none
sub reply_message
{
- my ($curproc, $msg, $args) = @_;
+ my ($curproc, $msg, $rm_args) = @_;
my $myname = $curproc->myname();
$curproc->caller_info($msg, caller) if $debug;
@@ -1378,8 +1378,8 @@ sub reply_message
}
# get recipients list
- my ($recipient, $recipient_maps) = $curproc->_analyze_recipients($args);
- my $hdr = $curproc->_analyze_header($args);
+ my ($recipient, $recipient_maps) = $curproc->_analyze_recipients($rm_args);
+ my $hdr = $curproc->_analyze_header($rm_args);
# check text messages and fix if needed.
unless (ref($msg)) {
@@ -1387,14 +1387,14 @@ sub reply_message
$msg .= "\n" unless $msg =~ /\n$/;
}
- $curproc->_append_message_into_queue2($msg, $args,
+ $curproc->_append_message_into_queue2($msg, $rm_args,
$recipient, $recipient_maps,
$hdr);
- if (defined $args->{ always_cc }) {
+ if (defined $rm_args->{ always_cc }) {
# only if $recipient above != always_cc, duplicate $msg message.
my $sent = $recipient;
- my $cc = $args->{ always_cc };
+ my $cc = $rm_args->{ always_cc };
my $recipient = [];
if (ref($cc) eq 'ARRAY') {
@@ -1406,7 +1406,7 @@ sub reply_message
if (_array_is_different($sent, $recipient)) {
$curproc->log("cc: [ @$recipient ]");
- $curproc->_append_message_into_queue($msg, $args,
+ $curproc->_append_message_into_queue($msg, $rm_args,
$recipient, $recipient_maps,
$hdr);
}
@@ -1415,17 +1415,17 @@ sub reply_message
# Descriptions: return recipient info.
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc) HASH_REF($rm_args)
# Side Effects: none
# Return Value: ARRAY( ARRAY_REF, ARRAY_REF)
sub _analyze_recipients
{
- my ($curproc, $args) = @_;
+ my ($curproc, $rm_args) = @_;
my $recipient = [];
my $recipient_maps = [];
- my $rcpt = $args->{ recipient } if defined $args->{ recipient };
- my $map = $args->{ recipient_map } if defined $args->{ recipient_map };
- my $maps = $args->{ recipient_maps } if defined $args->{ recipient_maps };
+ my $rcpt = $rm_args->{ recipient } if defined $rm_args->{ recipient };
+ my $map = $rm_args->{ recipient_map } if defined $rm_args->{ recipient_map };
+ my $maps = $rm_args->{ recipient_maps } if defined $rm_args->{ recipient_maps };
if (defined($rcpt)) {
if (ref($rcpt) eq 'ARRAY') {
@@ -1471,13 +1471,13 @@ sub _analyze_recipients
# Descriptions: return header parameters
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc) HASH_REF($rm_args)
# Side Effects: none
# Return Value: HASH_REF
sub _analyze_header
{
- my ($curproc, $args) = @_;
- return $args->{ header };
+ my ($curproc, $rm_args) = @_;
+ return $rm_args->{ header };
}
@@ -2263,17 +2263,17 @@ C<Caution:>
# 2. expand variables: $ml_name -> elena
# 3. back kanji code: euc -> iso-2022-jp
# 4. return the new created template
-# Arguments: OBJ($curproc) HASH_REF($args)
+# Arguments: OBJ($curproc) HASH_REF($pf_args)
# Side Effects: none
# Return Value: a new filepath (string) to be prepared
sub prepare_file_to_return
{
- my ($curproc, $args) = @_;
+ my ($curproc, $pf_args) = @_;
my $config = $curproc->config();
my $tmp_dir = $config->{ tmp_dir };
my $tmpf = File::Spec->catfile($tmp_dir, $$);
- my $src_file = $args->{ src };
- my $charset_out = $args->{ charset };
+ my $src_file = $pf_args->{ src };
+ my $charset_out = $pf_args->{ charset };
-d $tmp_dir || $curproc->mkdir($tmp_dir, "mode=private");
@@ -2292,7 +2292,7 @@ sub prepare_file_to_return
my $buf;
while ($buf = <$rh>) {
if ($buf =~ /\$/o) {
- $config->expand_variable_in_buffer(\$buf, $args);
+ $config->expand_variable_in_buffer(\$buf, $pf_args);
}
$wh->print( $obj->convert( $buf, 'jis-jp' ) );
}