diff options
| author | fukachan <fukachan> | 2003-03-14 06:54:51 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-03-14 06:54:51 +0000 |
| commit | 01d65fd0ec1e50d56496c0a8713b643fef9fe760 (patch) | |
| tree | f539e01b80e84a9658b1629c390081404b8b5b2d | |
| parent | 447aabe537a3d778d0aa74e4f62107501e3825e7 (diff) | |
| download | fml8-01d65fd0ec1e50d56496c0a8713b643fef9fe760.tar.gz fml8-01d65fd0ec1e50d56496c0a8713b643fef9fe760.tar.bz2 fml8-01d65fd0ec1e50d56496c0a8713b643fef9fe760.zip | |
validate input.
implement dump() method to show the whole summary_file.
| -rw-r--r-- | fml/lib/FML/Article/Summary.pm | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/fml/lib/FML/Article/Summary.pm b/fml/lib/FML/Article/Summary.pm index 0a6ecb32..3fbe99ac 100644 --- a/fml/lib/FML/Article/Summary.pm +++ b/fml/lib/FML/Article/Summary.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: Summary.pm,v 1.9 2003/01/11 16:05:13 fukachan Exp $ +# $FML: Summary.pm,v 1.10 2003/02/16 08:48:05 fukachan Exp $ # package FML::Article::Summary; @@ -97,14 +97,17 @@ sub _prepare_info use Mail::Message; my $msg = new Mail::Message->parse( { file => $file } ); my $header = $msg->whole_message_header(); - my $address = $header->get( 'from' ); - my $date = $header->get( 'date' ); + my $address = $header->get( 'from' ) || ''; + my $date = $header->get( 'date' ) || ''; my $unixtime = Mail::Message::Date::date_to_unixtime( $date ); # log the first 15 bytes of user@domain in From: header field. - use FML::Header; - my $hdrobj = new FML::Header; - $address = substr($hdrobj->address_clean_up( $address ), 0, $addrlen); + if (defined $address) { + use FML::Header; + my $hdr = new FML::Header; + my $addr = $hdr->address_clean_up($address); + $address = defined $addr ? substr($addr, 0, $addrlen) : ''; + } # XXX-TODO $subject->clean_up() (object flavour?) use FML::Header::Subject; @@ -249,6 +252,28 @@ sub rebuild } +# Descriptions: print all lines in summary file into file handle $wh. +# Arguments: OBJ($self) HANDLE($wh) +# Side Effects: none +# Return Value: none +sub dump +{ + my ($self, $wh) = @_; + my $curproc = $self->{ _curproc }; + my $config = $curproc->config(); + my $summary_file = $config->{ "summary_file" }; + + if (-f $summary_file) { + my $fh = new FileHandle $summary_file; + if (defined $fh && defined $wh) { + my $buf; + while ($buf = <$fh>) { print $wh $buf;} + $fh->close(); + } + } +} + + =head1 CODING STYLE See C<http://www.fml.org/software/FNF/> on fml coding style guide. |
