diff options
| author | fukachan <fukachan> | 2001-03-14 04:04:20 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-03-14 04:04:20 +0000 |
| commit | b6fffd0946f72e6a70de03a3748020597bee46c6 (patch) | |
| tree | e65c27422c781b46c85c4285eb67e32e608daa46 /fml | |
| parent | f0c8836292de3f33baa9d20577e7147d4aa3c9c2 (diff) | |
| download | fml8-b6fffd0946f72e6a70de03a3748020597bee46c6.tar.gz fml8-b6fffd0946f72e6a70de03a3748020597bee46c6.tar.bz2 fml8-b6fffd0946f72e6a70de03a3748020597bee46c6.zip | |
change argument of FML::Command method call. now it accpepts
method($self, $curproc, $args) where $args is prepared at
FML::Process::Configure().
move the main code to subscribe.pm and unsubscribe.pm and change
add.pm and bye.pm as an adapter for them.
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/FML/Command/add.pm | 45 | ||||
| -rw-r--r-- | fml/lib/FML/Command/bye.pm | 32 | ||||
| -rw-r--r-- | fml/lib/FML/Command/delete.pm | 6 | ||||
| -rw-r--r-- | fml/lib/FML/Command/newml.pm | 8 | ||||
| -rw-r--r-- | fml/lib/FML/Command/subscribe.pm | 42 | ||||
| -rw-r--r-- | fml/lib/FML/Command/unsubscribe.pm | 37 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Configure.pm | 25 |
7 files changed, 91 insertions, 104 deletions
diff --git a/fml/lib/FML/Command/add.pm b/fml/lib/FML/Command/add.pm index 91682b70..a2348e23 100644 --- a/fml/lib/FML/Command/add.pm +++ b/fml/lib/FML/Command/add.pm @@ -13,6 +13,8 @@ use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; +@ISA = qw(FML::Command::subscribe); + =head1 NAME FML::Command::add - add a new member @@ -21,49 +23,6 @@ FML::Command::add - add a new member =head1 DESCRIPTION -=head1 METHODS - -=head2 C<new()> - -=cut - -sub new -{ - my ($self) = @_; - my ($type) = ref($self) || $self; - my $me = {}; - - print STDERR " FML::Comand::add::new() \n"; - - return bless $me, $type; -} - - -=head2 C<add( $address )> - -=cut - - -sub add -{ - my ($self, $curproc, $address) = @_; - my $config = $curproc->{ config }; - my $member_map = $config->{ primary_member_map }; - my $recipient_map = $config->{ primary_recipient_map }; - - # fundamental check - croak("\$member_map is not specified") unless $member_map; - croak("\$recipient_map is not specified") unless $recipient_map; - - use IO::MapAdapter; - my $obj = new IO::MapAdapter $member_map; - $obj->add( $address ); - - $obj = new IO::MapAdapter $recipient_map; - $obj->add( $address ); -} - - =head1 AUTHOR Ken'ichi Fukamachi diff --git a/fml/lib/FML/Command/bye.pm b/fml/lib/FML/Command/bye.pm index 06b279f3..b7592770 100644 --- a/fml/lib/FML/Command/bye.pm +++ b/fml/lib/FML/Command/bye.pm @@ -13,50 +13,30 @@ use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; +@ISA = qw(FML::Command::unsubscribe); + =head1 NAME -FML::Command::bye - what is this +FML::Command::bye - remove the specified member =head1 SYNOPSIS -not yet implemented - =head1 DESCRIPTION -=head1 METHODS - -=head2 C<new()> - -=cut - - -require Exporter; -@ISA = qw(Exporter); - - -sub new -{ - my ($self) = @_; - my ($type) = ref($self) || $self; - my $me = {}; - return bless $me, $type; -} - - =head1 AUTHOR -__YOUR_NAME__ +Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001 __YOUR_NAME__ +Copyright (C) 2001 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 HISTORY -FML::Command::bye appeared in fml5 mailing list driver package. +FML::MemberControl appeared in fml5 mailing list driver package. See C<http://www.fml.org/> for more details. =cut diff --git a/fml/lib/FML/Command/delete.pm b/fml/lib/FML/Command/delete.pm index c1717ac0..3b3fea3d 100644 --- a/fml/lib/FML/Command/delete.pm +++ b/fml/lib/FML/Command/delete.pm @@ -38,10 +38,12 @@ sub new sub delete { - my ($self, $curproc, $address) = @_; - my $config = $curproc->{ config }; + my ($self, $curproc, $args) = @_; + my $config = $curproc->{ config }; my $member_map = $config->{ primary_member_map }; my $recipient_map = $config->{ primary_recipient_map }; + my $options = $args->{ options }; + my $address = $options->[ 0 ]; # fundamental check croak("\$member_map is not specified") unless $member_map; diff --git a/fml/lib/FML/Command/newml.pm b/fml/lib/FML/Command/newml.pm index 070fed3d..42da0f6e 100644 --- a/fml/lib/FML/Command/newml.pm +++ b/fml/lib/FML/Command/newml.pm @@ -19,6 +19,10 @@ FML::Command::newml - make a new mailing list =head1 SYNOPSIS + use FML::Command::newml; + $obj = new FML::Command::newml; + $obj->newml($curproc, $args); + =head1 DESCRIPTION =head1 METHODS @@ -27,6 +31,7 @@ FML::Command::newml - make a new mailing list =cut + sub new { my ($self) = @_; @@ -43,10 +48,11 @@ sub new sub newml { - my ($self, $curproc, $ml_name) = @_; + my ($self, $curproc, $args) = @_; my $config = $curproc->{ config }; my $member_map = $config->{ primary_member_map }; my $recipient_map = $config->{ primary_recipient_map }; + my $ml_name = $args->{ ml_name }; # fundamental check croak("\$ml_name is not specified") unless $ml_name; diff --git a/fml/lib/FML/Command/subscribe.pm b/fml/lib/FML/Command/subscribe.pm index 6598e619..4421b27f 100644 --- a/fml/lib/FML/Command/subscribe.pm +++ b/fml/lib/FML/Command/subscribe.pm @@ -15,12 +15,10 @@ use Carp; =head1 NAME -FML::Command::subscribe - what is this +FML::Command::subscribe - subscribe a new member =head1 SYNOPSIS -not yet implemented - =head1 DESCRIPTION =head1 METHODS @@ -29,11 +27,6 @@ not yet implemented =cut - -require Exporter; -@ISA = qw(Exporter); - - sub new { my ($self) = @_; @@ -43,20 +36,47 @@ sub new } +=head2 C<subscribe( $address )> + +=cut + + +sub subscribe +{ + my ($self, $curproc, $args) = @_; + my $config = $curproc->{ config }; + my $member_map = $config->{ primary_member_map }; + my $recipient_map = $config->{ primary_recipient_map }; + my $options = $args->{ options }; + my $address = $options->[ 0 ]; + + # fundamental check + croak("\$member_map is not specified") unless $member_map; + croak("\$recipient_map is not specified") unless $recipient_map; + + use IO::MapAdapter; + my $obj = new IO::MapAdapter $member_map; + $obj->add( $address ); + + $obj = new IO::MapAdapter $recipient_map; + $obj->add( $address ); +} + + =head1 AUTHOR -__YOUR_NAME__ +Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001 __YOUR_NAME__ +Copyright (C) 2001 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 HISTORY -FML::Command::subscribe appeared in fml5 mailing list driver package. +FML::MemberControl appeared in fml5 mailing list driver package. See C<http://www.fml.org/> for more details. =cut diff --git a/fml/lib/FML/Command/unsubscribe.pm b/fml/lib/FML/Command/unsubscribe.pm index ac284c37..2b743d40 100644 --- a/fml/lib/FML/Command/unsubscribe.pm +++ b/fml/lib/FML/Command/unsubscribe.pm @@ -15,12 +15,10 @@ use Carp; =head1 NAME -FML::Command::unsubscribe - what is this +FML::Command::unsubscribe - remove the specified member =head1 SYNOPSIS -not yet implemented - =head1 DESCRIPTION =head1 METHODS @@ -29,11 +27,6 @@ not yet implemented =cut - -require Exporter; -@ISA = qw(Exporter); - - sub new { my ($self) = @_; @@ -43,20 +36,42 @@ sub new } +sub unsubscribe +{ + my ($self, $curproc, $args) = @_; + my $config = $curproc->{ config }; + my $member_map = $config->{ primary_member_map }; + my $recipient_map = $config->{ primary_recipient_map }; + my $options = $args->{ options }; + my $address = $options->[ 0 ]; + + # fundamental check + croak("\$member_map is not specified") unless $member_map; + croak("\$recipient_map is not specified") unless $recipient_map; + + use IO::MapAdapter; + my $obj = new IO::MapAdapter $member_map; + $obj->delete( $address ); + + $obj = new IO::MapAdapter $recipient_map; + $obj->delete( $address ); +} + + =head1 AUTHOR -__YOUR_NAME__ +Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001 __YOUR_NAME__ +Copyright (C) 2001 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 HISTORY -FML::Command::unsubscribe appeared in fml5 mailing list driver package. +FML::MemberControl appeared in fml5 mailing list driver package. See C<http://www.fml.org/> for more details. =cut diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm index dfe9d17c..38ba8b2b 100644 --- a/fml/lib/FML/Process/Configure.pm +++ b/fml/lib/FML/Process/Configure.pm @@ -113,16 +113,21 @@ sub _makefml # local scope local(@ISA) = ($pkg, @ISA); + # arguments to pass off to each method + my $args = { + command => $command, + ml_name => $ml_name, + options => \@options, + argv => $argv, + }; + eval qq{ require $pkg; $pkg->import();}; - if ($@) { - Log( $@ ); - return ; - } + if ($@) { Log($@); croak("command=$command is not supported.");} # here we go $curproc->lock(); - my $obj = $pkg->new; - $obj->$method($curproc, @options); + my $obj = $pkg->new; + $obj->$method($curproc, $args); $curproc->unlock(); } else { @@ -139,11 +144,11 @@ sub _which_makefml_method { my ($self, $command) = @_; my $method = { - 'add' => 'add', - 'subscribe' => 'add', + 'add' => 'subscribe', + 'subscribe' => 'subscribe', - 'bye' => 'delete', - 'unsubscribe' => 'delete', + 'bye' => 'unsubscribe', + 'unsubscribe' => 'unsubscribe', 'newml' => 'newml', }; |
