diff options
| author | fukachan <fukachan> | 2002-11-26 09:44:37 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-11-26 09:44:37 +0000 |
| commit | 2adcd83e5f448b08f9b7dd37cdf05bbd4ce83408 (patch) | |
| tree | 907f2c690baf9d12a58ecac323127ab397007474 /fml/lib | |
| parent | 27919704ed51913a9138b5b8aad25553458d4803 (diff) | |
| download | fml8-2adcd83e5f448b08f9b7dd37cdf05bbd4ce83408.tar.gz fml8-2adcd83e5f448b08f9b7dd37cdf05bbd4ce83408.tar.bz2 fml8-2adcd83e5f448b08f9b7dd37cdf05bbd4ce83408.zip | |
FNF-ify.
clean up.
nuke debug.
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Article/Summary.pm | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/fml/lib/FML/Article/Summary.pm b/fml/lib/FML/Article/Summary.pm index f097f04f..d1e06fcd 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: @template.pm,v 1.6 2002/09/28 05:36:03 fukachan Exp $ +# $FML: Summary.pm,v 1.1.1.1 2002/11/26 07:42:19 fukachan Exp $ # package FML::Article::Summary; @@ -29,8 +29,8 @@ FML::Article::Summary - generate article summary =cut -# Descriptions: -# Arguments: OBJ($self) HASH_REF($args) +# Descriptions: usual constructor. +# Arguments: OBJ($self) OBJ($curproc) # Side Effects: # Return Value: none sub new @@ -38,11 +38,17 @@ sub new my ($self, $curproc) = @_; my ($type) = ref($self) || $self; my $me = {}; + $me->{ _curproc } = $curproc; + return bless $me, $type; } +# Descriptions: append summary to $summary_file +# Arguments: OBJ($self) NUM($id) +# Side Effects: append summary to $summary_file +# Return Value: none sub print { my ($self, $id) = @_; @@ -50,8 +56,6 @@ sub print my $config = $curproc->config(); my $file = $config->{ 'summary_file' }; - print STDERR "open summary_file=$file id=$id\n"; - use FileHandle; my $wh = new FileHandle ">> $file"; if (defined $wh) { @@ -63,30 +67,40 @@ sub print } +# Descriptions: prepare infomation on article $id for later use +# such as $id, $address, $subject et.al. +# Arguments: OBJ($self) NUM($id) +# Side Effects: none +# Return Value: HASH_REF sub _prepare_info { my ($self, $id) = @_; my $curproc = $self->{ _curproc }; + my $config = $curproc->config(); + my $tag = $config->{ article_subject_tag }; use FML::Article; - use Mail::Message; my $article = new FML::Article $curproc; my $file = $article->filepath($id); + + use Mail::Message; my $msg = new Mail::Message->parse( { file => $file } ); my $header = $msg->whole_message_header(); my $address = $header->get( 'from' ); - # extract the first 15 bytes of user@domain part. + # extract the first 15 bytes of user@domain part from From: header field. use FML::Header; my $hdrobj = new FML::Header; - $address = substr( $hdrobj->address_clean_up( $address ), 0, 15); + $address = substr($hdrobj->address_clean_up( $address ), 0, 15); # fold "\n" - my $subject = $header->get( 'subject' ); + use FML::Header::Subject; + my $obj = new FML::Header::Subject; + my $subject = $obj->clean_up($header->get('subject'), $tag); $subject =~ s/\s*\n/ /g; $subject =~ s/\s+/ /g; - my $info = { + my $info = { id => $id, address => $address, subject => $subject, @@ -96,6 +110,10 @@ sub _prepare_info } +# Descriptions: one line version of print(). +# Arguments: OBJ($self) HANDLE($wh) HASH_REF($info) +# Side Effects: none +# Return Value: none sub print_one_line_summary { my ($self, $wh, $info) = @_; @@ -112,6 +130,10 @@ sub print_one_line_summary } +# Descriptions: write out formatted string into $summary_file. +# Arguments: OBJ($self) HANDLE($wh) HASH_REF($info) +# Side Effects: update $summary_file. +# Return Value: none sub _fml4_compatible_style_one_line_summary { my ($self, $wh, $info) = @_; @@ -137,15 +159,6 @@ sub _fml4_compatible_style_one_line_summary } -if ($0 eq __FILE__) { - my $obj = new FML::Article::Summary; - $obj->_one_line_summary("\%d \%s\n", [ - 1000, - "uja" - ]); -} - - =head1 CODING STYLE See C<http://www.fml.org/software/FNF/> on fml coding style guide. |
