diff options
| author | fukachan <fukachan> | 2003-09-13 13:01:01 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-09-13 13:01:01 +0000 |
| commit | 6204390c0d8a7dbaa21fedfbe8f2ceae13d5c6f3 (patch) | |
| tree | eaeca0543cde7e955b3c30497879dce6fd758903 /fml | |
| parent | 6516e5bd0eddd74001051ff507e15e4e58330932 (diff) | |
| download | fml8-6204390c0d8a7dbaa21fedfbe8f2ceae13d5c6f3.tar.gz fml8-6204390c0d8a7dbaa21fedfbe8f2ceae13d5c6f3.tar.bz2 fml8-6204390c0d8a7dbaa21fedfbe8f2ceae13d5c6f3.zip | |
fix variable initialization to avoid undefined reference warning.
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/FML/Filter/MimeComponent3.pm | 37 | ||||
| -rw-r--r-- | fml/lib/Mail/Message.pm | 12 |
2 files changed, 28 insertions, 21 deletions
diff --git a/fml/lib/FML/Filter/MimeComponent3.pm b/fml/lib/FML/Filter/MimeComponent3.pm index 4a17db9f..b06cde93 100644 --- a/fml/lib/FML/Filter/MimeComponent3.pm +++ b/fml/lib/FML/Filter/MimeComponent3.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: MimeComponent3.pm,v 1.17 2003/08/23 14:38:00 fukachan Exp $ +# $FML: MimeComponent3.pm,v 1.18 2003/08/25 14:13:58 fukachan Exp $ # package FML::Filter::MimeComponent; @@ -221,7 +221,7 @@ sub _rule_match { my ($self, $msg, $rule, $mp, $whole_type) = @_; my ($r_whole_type, $r_type, $r_action) = @$rule; - my $type = $mp->data_type(); + my $type = $mp->data_type() || ''; if (__regexp_match($whole_type, $r_whole_type)) { if (__regexp_match($type, $r_type)) { @@ -250,6 +250,9 @@ sub __regexp_match my ($type, $regexp) = @_; my $reverse = 0; + $type ||= ''; + $regexp ||= ''; + # case insensitive $type =~ tr/A-Z/a-z/; $regexp =~ tr/A-Z/a-z/; @@ -280,24 +283,28 @@ sub __basic_regexp_match { my ($type, $regexp) = @_; - # prepare variables to compare - my ($xl, $xr) = split(/\//, $type); # text/plain - my ($rl, $rr) = split(/\//, $regexp); # text/* - if ($regexp eq '*') { $rl = $rr = '*';} # * => */* - - # check left hand side - if ($xl eq $rl || $rl eq '*') { - # check right hand side - if ($xr eq $rr || $rr eq '*') { - return 1; # both left and right hand sides ok + if (defined $type && $type && defined $regexp && $regexp) { + # prepare variables to compare + my ($xl, $xr) = split(/\//, $type); # text/plain + my ($rl, $rr) = split(/\//, $regexp); # text/* + if ($regexp eq '*') { $rl = $rr = '*';} # * => */* + + # check left hand side + if ($xl eq $rl || $rl eq '*') { + # check right hand side + if ($xr eq $rr || $rr eq '*') { + return 1; # both left and right hand sides ok + } + else { + return 0; + } } else { return 0; } } - else { - return 0; - } + + return 0; } diff --git a/fml/lib/Mail/Message.pm b/fml/lib/Mail/Message.pm index 8a3336ff..1186d908 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.83 2003/08/20 15:21:17 fukachan Exp $ +# $FML: Message.pm,v 1.84 2003/09/08 09:30:09 fukachan Exp $ # package Mail::Message; @@ -1921,7 +1921,7 @@ return this message has empty content or not. sub is_multipart { my ($self) = @_; - my $type = $self->whole_message_header_data_type(); + my $type = $self->whole_message_header_data_type() || ''; return( ($type =~ /multipart/i) ? 1 : 0 ); } @@ -1941,13 +1941,13 @@ return charset. sub charset { my ($self) = @_; - my $buf = $self->message_fields(); + my $buf = $self->message_fields() || ''; # special case: $self equals to header object (head of a chain) unless ($buf) { my $data = $self->{ data }; if (ref($data) eq 'Mail::Header' || ref($data) eq 'FML::Header') { - $buf = $data->get('content-type'); + $buf = $data->get('content-type') || ''; $buf =~ s/\s+/ /g; $buf = "content-type: $buf"; } @@ -1984,13 +1984,13 @@ The return value is one of base64, quoted-printable or undef. sub encoding_mechanism { my ($self) = @_; - my $buf = $self->message_fields(); + my $buf = $self->message_fields() || ''; # special case: $self equals to header object (head of a chain) unless ($buf) { my $data = $self->{ data }; if (ref($data) eq 'Mail::Header' || ref($data) eq 'FML::Header') { - $buf = $data->get('content-transfer-encoding'); + $buf = $data->get('content-transfer-encoding') || ''; $buf = "Content-Transfer-Encoding: $buf"; } } |
