diff options
| author | fukachan <fukachan> | 2002-12-20 03:50:26 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-12-20 03:50:26 +0000 |
| commit | c7a3ef5f00b5cc5ce34163b63b01190b976f5503 (patch) | |
| tree | 56d2c91b147249f1a0163c4a758723b5d22362fc /fml | |
| parent | 11e81f65bb5de90e1490e18525639a3872dde8fb (diff) | |
| download | fml8-c7a3ef5f00b5cc5ce34163b63b01190b976f5503.tar.gz fml8-c7a3ef5f00b5cc5ce34163b63b01190b976f5503.tar.bz2 fml8-c7a3ef5f00b5cc5ce34163b63b01190b976f5503.zip | |
use return().
fix comments.
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/Mail/Delivery.pm | 9 | ||||
| -rw-r--r-- | fml/lib/Mail/Delivery/Net/INET4.pm | 7 | ||||
| -rw-r--r-- | fml/lib/Mail/Delivery/Net/INET6.pm | 5 | ||||
| -rw-r--r-- | fml/lib/Mail/Delivery/Queue.pm | 22 | ||||
| -rw-r--r-- | fml/lib/Mail/Delivery/Utils.pm | 21 |
5 files changed, 45 insertions, 19 deletions
diff --git a/fml/lib/Mail/Delivery.pm b/fml/lib/Mail/Delivery.pm index c1df7a52..553eaaff 100644 --- a/fml/lib/Mail/Delivery.pm +++ b/fml/lib/Mail/Delivery.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2000-2001 Ken'ichi Fukamachi +# Copyright (C) 2000,2001,2002 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. # -# $FML: Delivery.pm,v 1.6 2002/09/11 23:18:21 fukachan Exp $ +# $FML: Delivery.pm,v 1.7 2002/09/22 14:56:59 fukachan Exp $ # package Mail::Delivery; @@ -28,6 +28,7 @@ Mail::Delivery - mail delivery system interface }; if ($service->error) { Log($service->error); return;} + # specify IO::Adapter parameters if needed. $map_params = { 'mysql:toymodel' => { getline => "select ... ", @@ -53,7 +54,7 @@ Mail::Delivery - mail delivery system interface This class provides the entrance for sub classes. Actually implementation of this class is -almost C<Mail::Delivery::SMTP> class. +almost same as C<Mail::Delivery::SMTP> class. Please see it for more details. =head1 DESCRIPTION @@ -139,7 +140,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001 Ken'ichi Fukamachi +Copyright (C) 2000,2001,2002 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. diff --git a/fml/lib/Mail/Delivery/Net/INET4.pm b/fml/lib/Mail/Delivery/Net/INET4.pm index 888328cc..cc7cffd8 100644 --- a/fml/lib/Mail/Delivery/Net/INET4.pm +++ b/fml/lib/Mail/Delivery/Net/INET4.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: INET4.pm,v 1.5 2002/09/11 23:18:24 fukachan Exp $ +# $FML: INET4.pm,v 1.6 2002/09/22 14:57:03 fukachan Exp $ # package Mail::Delivery::Net::INET4; @@ -26,10 +26,11 @@ require Exporter; sub connect4 { my ($self, $args) = @_; - my $mta = $args->{ _mta }; - my $socket = ''; + my $mta = $args->{ _mta }; + my $socket = undef; # avoid croak() in IO::Socket module; + # XXX-TODO: how long is timeout ??? (where we specified ?) eval { local($SIG{ALRM}) = sub { Log("Error: timeout to connect $mta");}; use IO::Socket; diff --git a/fml/lib/Mail/Delivery/Net/INET6.pm b/fml/lib/Mail/Delivery/Net/INET6.pm index 2b364771..95d042f1 100644 --- a/fml/lib/Mail/Delivery/Net/INET6.pm +++ b/fml/lib/Mail/Delivery/Net/INET6.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: INET6.pm,v 1.9 2002/09/11 23:18:25 fukachan Exp $ +# $FML: INET6.pm,v 1.10 2002/09/22 14:57:03 fukachan Exp $ # package Mail::Delivery::Net::INET6; @@ -55,7 +55,7 @@ sub is_ipv6_ready _we_can_use_Socket6($self, $args); }; - $self->{_ipv6_ready} eq 'yes' ? 1 : 0; + return ($self->{_ipv6_ready} eq 'yes' ? 1 : 0); } @@ -122,6 +122,7 @@ sub connect6 # clean up delete $self->{_socket} if defined $self->{_socket}; + # XXX-TODO: "LOOP" is an appropriate label ? LOOP: while (scalar(@res) >= 5) { ($family, $type, $proto, $saddr, $canonname, @res) = @res; diff --git a/fml/lib/Mail/Delivery/Queue.pm b/fml/lib/Mail/Delivery/Queue.pm index d3bc3807..13277093 100644 --- a/fml/lib/Mail/Delivery/Queue.pm +++ b/fml/lib/Mail/Delivery/Queue.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: Queue.pm,v 1.20 2002/11/17 14:07:34 fukachan Exp $ +# $FML: Queue.pm,v 1.21 2002/11/19 14:13:22 fukachan Exp $ # package Mail::Delivery::Queue; @@ -91,7 +91,7 @@ sub new $me->{ _directory } = $dir; $me->{ _id } = $id; $me->{ _status } = "new"; - $me->{ _new_qf } = File::Spec->catfile($dir, "new", $id); + $me->{ _new_qf } = File::Spec->catfile($dir, "new", $id); $me->{ _active_qf } = File::Spec->catfile($dir, "active", $id); # queue directory mode @@ -99,12 +99,13 @@ sub new $dir_mode = $args->{ directory_mode }; } - # infomation for delivery + # must information for delivery $me->{ _info }->{ sender } = - File::Spec->catfile($dir, "info", "sender", $id); + File::Spec->catfile($dir, "info", "sender", $id); $me->{ _info }->{ recipients } = File::Spec->catfile($dir, "info", "recipients", $id); + # create directories in queue if not exists. for ($dir, File::Spec->catfile($dir, "active"), File::Spec->catfile($dir, "new"), @@ -148,7 +149,7 @@ sub _new_queue_id =head2 C<id()> -return the queue id assigned to the object C<$self>. +return the queue id assigned to this object C<$self>. =cut @@ -166,7 +167,7 @@ sub id =head2 C<filename()> -return the file name of the queue id assigned to the object C<$self>. +return the file name of the queue id assigned to this object C<$self>. =cut @@ -204,6 +205,8 @@ where C<$qid> is like this: 990157187.20792.1 sub list { my ($self) = @_; + + # XXX-TODO: we need method e.g. active_dirpath(); my $dir = File::Spec->catfile( $self->{ _directory }, "active"); use DirHandle; @@ -248,9 +251,10 @@ sub getidinfo my $dir = $self->{ _directory }; my ($fh, $sender, @recipients); - # validate queue id is given + # validate if the queue id is given $id ||= $self->id(); + # XXX-TODO: we should provide e.g. sender_dir_path(). # sender use FileHandle; $fh = new FileHandle File::Spec->catfile($dir, "info", "sender", $id); @@ -260,6 +264,7 @@ sub getidinfo $fh->close; } + # XXX-TODO: we should provide e.g. recipients_dir_path(). # recipient array $fh = new FileHandle File::Spec->catfile($dir, "info", "recipients", $id); if (defined $fh) { @@ -358,6 +363,7 @@ sub in $fh->close; } + # check the existence and the size > 0. return( (-e $qf && -s $qf) ? 1 : 0 ); } @@ -395,6 +401,7 @@ sub set elsif ($key eq 'recipients') { my $fh = new FileHandle ">> $qf_recipients"; if (defined $fh) { + # XXX-TODO: validate $value == ARRAY_REF. for (@$value) { print $fh $_, "\n";} $fh->close; } @@ -402,6 +409,7 @@ sub set elsif ($key eq 'recipient_maps') { my $fh = new FileHandle ">> $qf_recipients"; if (defined $fh) { + # XXX-TODO: validate $value == ARRAY_REF. use IO::Adapter; for my $map (@$value) { my $obj = new IO::Adapter $map; diff --git a/fml/lib/Mail/Delivery/Utils.pm b/fml/lib/Mail/Delivery/Utils.pm index b21c6c83..c7d074bf 100644 --- a/fml/lib/Mail/Delivery/Utils.pm +++ b/fml/lib/Mail/Delivery/Utils.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: Utils.pm,v 1.8 2002/09/11 23:18:24 fukachan Exp $ +# $FML: Utils.pm,v 1.9 2002/09/22 14:57:02 fukachan Exp $ # package Mail::Delivery::Utils; @@ -45,7 +45,7 @@ require Exporter; =head1 NAME -Mail::Delivery::utils - utiliti programs for mail delivery +Mail::Delivery::utils - utility programs for mail delivery class =head1 SYNOPSIS @@ -80,6 +80,9 @@ the logging message is forwarded to STDERR channel. =cut +# XXX-TODO: we should provide both Log() and $delivery->log() methods ? + + # Descriptions: log by specified function pointer or into STDERR # Arguments: STR($buf) # Side Effects: none @@ -201,6 +204,9 @@ get the latest status code. sub _get_status_code { my ($self) = @_; + + # XXX-TODO: return what code if undefined ? + # XXX-TODO: consider Principle of Least Surprise! $self->{'_status_code'}; } @@ -256,6 +262,9 @@ sub _set_target_map sub _get_target_map { my ($self) = @_; + + # XXX-TODO: return what code if undefined ? + # XXX-TODO: consider Principle of Least Surprise! $self->{ _mapinfo }->{ _curmap }; } @@ -313,6 +322,9 @@ sub _set_map_position sub _get_map_status { my ($self, $map) = @_; + + # XXX-TODO: return what code if undefined ? + # XXX-TODO: consider Principle of Least Surprise! $self->{ _mapinfo }->{ $map }->{status}; } @@ -324,6 +336,9 @@ sub _get_map_status sub _get_map_position { my ($self, $map) = @_; + + # XXX-TODO: return what code if undefined ? + # XXX-TODO: consider Principle of Least Surprise! $self->{ _mapinfo }->{ $map }->{position}; } @@ -348,7 +363,7 @@ clear information around the latest map operation. sub _rollback_map_position { my ($self) = @_; - my $map = $self->_get_target_map; + my $map = $self->_get_target_map; # count the number of rollback to avoid infinite loop if ( $self->{ _map_rollback_info }->{ $map }->{ count } > 2 ) { |
