diff options
| author | fukachan <fukachan> | 2006-04-15 06:33:00 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2006-04-15 06:33:00 +0000 |
| commit | 9990e892608d33c2d404b81118bd3090c0eaecee (patch) | |
| tree | d461bfe39017c6c4f85c1d4f16aa9aa49ac9a24c | |
| parent | ca7f349cd51a9bd4a23512a553b2dbaaa34fbd71 (diff) | |
| download | fml8-9990e892608d33c2d404b81118bd3090c0eaecee.tar.gz fml8-9990e892608d33c2d404b81118bd3090c0eaecee.tar.bz2 fml8-9990e892608d33c2d404b81118bd3090c0eaecee.zip | |
nuke ambiguous method and variable name.
num_paragraph() -> paragraph_total() (XXX see "Code Complete").
each variable holding this return value is fixed to $total.
| -rw-r--r-- | fml/lib/FML/Filter/TextPlain.pm | 16 | ||||
| -rw-r--r-- | fml/lib/Mail/Bounce/DSN.pm | 12 | ||||
| -rw-r--r-- | fml/lib/Mail/Bounce/Postfix19991231.pm | 14 | ||||
| -rw-r--r-- | fml/lib/Mail/Bounce/Qmail.pm | 10 | ||||
| -rw-r--r-- | fml/lib/Mail/Bounce/SimpleMatch.pm | 12 | ||||
| -rw-r--r-- | fml/lib/Mail/Message.pm | 21 | ||||
| -rw-r--r-- | fml/lib/Mail/Message/Outline.pm | 12 | ||||
| -rw-r--r-- | fml/lib/Mail/Message/ToHTML.pm | 11 |
8 files changed, 61 insertions, 47 deletions
diff --git a/fml/lib/FML/Filter/TextPlain.pm b/fml/lib/FML/Filter/TextPlain.pm index 2eb20edf..ef210690 100644 --- a/fml/lib/FML/Filter/TextPlain.pm +++ b/fml/lib/FML/Filter/TextPlain.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005,2006 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: TextPlain.pm,v 1.15 2005/08/27 14:49:33 fukachan Exp $ +# $FML: TextPlain.pm,v 1.16 2005/09/16 11:11:33 fukachan Exp $ # package FML::Filter::TextPlain; @@ -137,7 +137,7 @@ sub body_check # XXX for small enough buffer. The information comes from @pmap, but # XXX we should implement methods for them within $m message object. # get useful information for the message object. - # my $num_paragraph = $m->num_paragraph(); + # my $paragraph_total = $m->paragraph_total(); # my $need_one_line_check = $self->need_one_line_check($m); ## 5. preparation for main rules. @@ -392,19 +392,19 @@ sub reject_japanese_command_syntax sub need_one_line_check { my ($self, $m) = @_; - my $np = $m->num_paragraph; + my $total = $m->paragraph_total; - if ($np == 1) { + if ($total == 1) { return 1; } - elsif ($np == 2) { + elsif ($total == 2) { # if the seconda paragraph looks signature, # this message has only one effective message (paragraph). if ($self->is_signature($m->nth_paragraph(2))) { return 1; } } - elsif ($np == 3) { + elsif ($total == 3) { # case 1: data + citation + signature # case 2: citation + data + signature if ($self->is_signature($m->nth_paragraph(3))) { @@ -540,7 +540,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005,2006 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/Bounce/DSN.pm b/fml/lib/Mail/Bounce/DSN.pm index 69d56501..8fb6e59d 100644 --- a/fml/lib/Mail/Bounce/DSN.pm +++ b/fml/lib/Mail/Bounce/DSN.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005,2006 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: DSN.pm,v 1.25 2005/08/19 12:17:11 fukachan Exp $ +# $FML: DSN.pm,v 1.26 2005/08/19 12:18:12 fukachan Exp $ # @@ -91,10 +91,10 @@ sub analyze if (defined $m) { # data in the part - my $data = $m->message_text; - my $n = $m->num_paragraph; + my $data = $m->message_text; + my $total = $m->paragraph_total; - for (my $i = 0; $i < $n; $i++) { + for (my $i = 0; $i < $total; $i++) { my $buf = $m->nth_paragraph($i + 1); # 1 not 0 for 1st paragraph if ($buf =~ /Recipient/) { $self->_parse_dsn_format($buf, $result); @@ -171,7 +171,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005,2006 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/Bounce/Postfix19991231.pm b/fml/lib/Mail/Bounce/Postfix19991231.pm index 9f9cc4a1..94ab76f3 100644 --- a/fml/lib/Mail/Bounce/Postfix19991231.pm +++ b/fml/lib/Mail/Bounce/Postfix19991231.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005,2006 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: Postfix19991231.pm,v 1.25 2005/08/19 12:17:11 fukachan Exp $ +# $FML: Postfix19991231.pm,v 1.26 2005/08/19 12:18:12 fukachan Exp $ # @@ -89,8 +89,8 @@ sub _analyze_plaintext my $m = $msg->{ next }; do { if (defined $m) { - my $num = $m->num_paragraph; - for ( my $i = 0; $i < $num ; $i++ ) { + my $total = $m->paragraph_total; + for ( my $i = 0; $i < $total ; $i++ ) { my $data = $m->nth_paragraph( $i + 1 ); # debug @@ -125,8 +125,8 @@ sub _analyze_broken_dsn my $m = $msg->find( { data_type => 'text/plain' } ); if (defined $m) { - my $num = $m->num_paragraph; - for ( my $i = 0; $i < $num ; $i++ ) { + my $total = $m->paragraph_total; + for ( my $i = 0; $i < $total ; $i++ ) { my $data = $m->nth_paragraph( $i + 1 ); # debug @@ -171,7 +171,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005,2006 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/Bounce/Qmail.pm b/fml/lib/Mail/Bounce/Qmail.pm index 0c06e337..f290664e 100644 --- a/fml/lib/Mail/Bounce/Qmail.pm +++ b/fml/lib/Mail/Bounce/Qmail.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005,2006 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: Qmail.pm,v 1.12 2005/05/26 13:12:42 fukachan Exp $ +# $FML: Qmail.pm,v 1.13 2005/08/19 12:17:11 fukachan Exp $ # @@ -50,8 +50,8 @@ sub analyze my $m = $msg->{ next }; do { if (defined $m) { - my $num = $m->num_paragraph; - for ( my $i = 0; $i < $num ; $i++ ) { + my $total = $m->paragraph_total; + for ( my $i = 0; $i < $total ; $i++ ) { my $data = $m->nth_paragraph( $i + 1 ); if ($data =~ /$pattern/o) { $state = 1;} @@ -98,7 +98,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005,2006 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/Bounce/SimpleMatch.pm b/fml/lib/Mail/Bounce/SimpleMatch.pm index adf3b2ce..3a417128 100644 --- a/fml/lib/Mail/Bounce/SimpleMatch.pm +++ b/fml/lib/Mail/Bounce/SimpleMatch.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005,2006 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: SimpleMatch.pm,v 1.43 2005/08/19 12:17:11 fukachan Exp $ +# $FML: SimpleMatch.pm,v 1.44 2005/08/19 12:18:12 fukachan Exp $ # @@ -205,11 +205,11 @@ sub analyze $m = $m->find( { data_type_regexp => 'text' } ); if (defined $m) { - my $n = $m->num_paragraph; - if ($debug) { print STDERR " num_paragraph: $n\n";} + my $total = $m->paragraph_total; + if ($debug) { print STDERR " paragraph_total: $total\n";} PARAGRAPH: - for (my $i = 0; $i < $n; $i++) { + for (my $i = 0; $i < $total; $i++) { my $buf = $m->nth_paragraph($i + 1); # 1 not 0 for 1st paragraph $args->{ buf } = \$buf; @@ -337,7 +337,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005,2006 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/Message.pm b/fml/lib/Mail/Message.pm index a287c3f3..f020f452 100644 --- a/fml/lib/Mail/Message.pm +++ b/fml/lib/Mail/Message.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: Message.pm,v 1.103 2005/09/11 13:12:45 fukachan Exp $ +# $FML: Message.pm,v 1.104 2006/01/09 14:00:55 fukachan Exp $ # package Mail::Message; @@ -2383,7 +2383,11 @@ sub data_type } -=head2 num_paragraph() +=head2 num_paragraphs() + +same as paragraph_total(). + +=head2 paragraph_total() return the number of paragraphs in the message ($self). @@ -2400,7 +2404,18 @@ The syntax is usual not C language flabour. # Arguments: OBJ($self) # Side Effects: none # Return Value: NUM -sub num_paragraph +sub num_paragraphs +{ + my ($self) = @_; + $self->paragraph_total(); +} + + +# Descriptions: return number of paragraphs in this object +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: NUM +sub paragraph_total { my ($self) = @_; diff --git a/fml/lib/Mail/Message/Outline.pm b/fml/lib/Mail/Message/Outline.pm index 16b958ec..7b1beebf 100644 --- a/fml/lib/Mail/Message/Outline.pm +++ b/fml/lib/Mail/Message/Outline.pm @@ -1,8 +1,8 @@ #-*- perl -*- # -# Copyright (C) 2005 Ken'ichi Fukamachi +# Copyright (C) 2005,2006 Ken'ichi Fukamachi # -# $FML$ +# $FML: Outline.pm,v 1.1 2005/09/11 13:12:46 fukachan Exp $ # package Mail::Message::Outline; @@ -57,10 +57,10 @@ sub outline my $prgbuf = ''; my $found = 0; my $max = $params->{ summary_max_lines } || 3; - my $np = $msg->num_paragraph(); + my $total = $msg->paragraph_total(); PARAGRAPH: - for my $i (1 .. $np) { + for my $i (1 .. $total) { $prgbuf = $msg->nth_paragraph($i); LINE: @@ -173,7 +173,7 @@ sub has_closing_phrase if (defined($msg) && $regexp) { my ($buf, $string); - my $num_prg = $msg->num_paragraph(); + my $num_prg = $msg->paragraph_total(); for (my $i = 1; $i <= $num_prg; $i++) { $buf = $msg->nth_paragraph($i); $buf =~ s/^[\s\n]*//o; @@ -229,7 +229,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2005 Ken'ichi Fukamachi +Copyright (C) 2005,2006 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/Message/ToHTML.pm b/fml/lib/Mail/Message/ToHTML.pm index d30aa471..271be43c 100644 --- a/fml/lib/Mail/Message/ToHTML.pm +++ b/fml/lib/Mail/Message/ToHTML.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: ToHTML.pm,v 1.80 2006/03/29 10:49:54 tmu Exp $ +# $FML: ToHTML.pm,v 1.81 2006/04/01 02:17:05 fukachan Exp $ # package Mail::Message::ToHTML; @@ -17,7 +17,7 @@ my $debug = 0; my $URL = "<A HREF=\"http://www.fml.org/software/\">Mail::Message::ToHTML</A>"; -my $version = q$FML: ToHTML.pm,v 1.80 2006/03/29 10:49:54 tmu Exp $; +my $version = q$FML: ToHTML.pm,v 1.81 2006/04/01 02:17:05 fukachan Exp $; my $versionid = 0; if ($version =~ /,v\s+([\d\.]+)\s+/) { $versionid = "$1"; @@ -815,16 +815,15 @@ return $str; sub _text_plain_part_safe_print { my ($self, $wh, $m) = @_; - my $i = 0; - my $n = $m->num_paragraph(); + my $total = $m->paragraph_total(); # print each paragraph. - for ($i = 1; $i <= $n ; $i++) { + for (my $i = 1; $i <= $total ; $i++) { my $buf = $m->nth_paragraph($i); # try to hide domain since the last paragraph must be signature. if ($self->{ _use_address_mask } eq 'yes') { - if ($i == $n) { + if ($i == $total) { $buf =~ s/(\w+\@[\w\.]+)/$self->_address_to_gecos($1)/ge; } } |
