diff options
| author | fukachan <fukachan> | 2001-11-09 15:09:03 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-11-09 15:09:03 +0000 |
| commit | e58ab94734c18a940f324b1fbf599df06f91fbbd (patch) | |
| tree | cb8df9f6e1e977de0625b108305012b56bd72fcd /fml | |
| parent | 9ac7d508ee2817ba6e50f63908f6740f80d0a6b3 (diff) | |
| download | fml8-e58ab94734c18a940f324b1fbf599df06f91fbbd.tar.gz fml8-e58ab94734c18a940f324b1fbf599df06f91fbbd.tar.bz2 fml8-e58ab94734c18a940f324b1fbf599df06f91fbbd.zip | |
check more by defined()
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/Print.pm | 10 | ||||
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/Print/Sort.pm | 22 |
2 files changed, 14 insertions, 18 deletions
diff --git a/fml/lib/Mail/ThreadTrack/Print.pm b/fml/lib/Mail/ThreadTrack/Print.pm index e4d2c808..777cc7de 100644 --- a/fml/lib/Mail/ThreadTrack/Print.pm +++ b/fml/lib/Mail/ThreadTrack/Print.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: Print.pm,v 1.11 2001/11/09 11:30:30 fukachan Exp $ +# $FML: Print.pm,v 1.12 2001/11/09 12:08:45 fukachan Exp $ # package Mail::ThreadTrack::Print; @@ -138,7 +138,7 @@ sub _do_summary sub _print_thread_summary { - my ($self, $thread_id) = @_; + my ($self, $thread_id_list) = @_; my $mode = $self->get_mode || 'text'; my $rh_age = $self->{ _age } || {}; my $fd = $self->{ _fd } || \*STDOUT; @@ -146,12 +146,12 @@ sub _print_thread_summary my $format = "%10s %5s %8s %-20s %s\n"; if ($mode eq 'text') { - print $fd "<TABLE BORDER=4>\n"; printf($fd $format, 'date', 'age', 'status', 'thread id', 'articles'); print $fd "-" x60; print $fd "\n"; } else { + print $fd "<TABLE BORDER=4>\n"; print "<TD>action\n"; print "<TD>date\n"."<TD>age\n"."<TD>status\n"."<TD>thread id\n"; print "<TD>article summary\n"; @@ -159,7 +159,9 @@ sub _print_thread_summary my ($tid, @article_id, $article_id, $date, $age, $status) = (); my $dh = new Mail::Message::Date; - for $tid (@$thread_id) { + for $tid (@$thread_id_list) { + next unless defined $rh->{ _articles }->{ $tid }; + # get the first $article_id from the article_id list (@article_id) = split(/\s+/, $rh->{ _articles }->{ $tid }); $article_id = $article_id[0]; diff --git a/fml/lib/Mail/ThreadTrack/Print/Sort.pm b/fml/lib/Mail/ThreadTrack/Print/Sort.pm index 0b675206..a6ab1429 100644 --- a/fml/lib/Mail/ThreadTrack/Print/Sort.pm +++ b/fml/lib/Mail/ThreadTrack/Print/Sort.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: Sort.pm,v 1.1 2001/11/09 11:28:42 fukachan Exp $ +# $FML: Sort.pm,v 1.2 2001/11/09 12:08:46 fukachan Exp $ # package Mail::ThreadTrack::Print::Sort; @@ -31,21 +31,13 @@ sub sort_thread_id $self->{ _age } = $age; $self->{ _cost } = $cost; - $self->_sort_thread_id($thread_id_list, $cost); -} - - -# Descriptions: -# Arguments: $self $args -# Side Effects: -# Return Value: none -sub _sort_thread_id -{ - my ($self, $thread_id_list, $cost) = @_; - @$thread_id_list = sort { - $cost->{$b} cmp $cost->{$a}; + (defined($cost->{$b}) ? $cost->{$b} : '') + cmp + (defined($cost->{$a}) ? $cost->{$a} : '') } @$thread_id_list; + + return $thread_id_list; } @@ -64,6 +56,8 @@ sub _calculate_age # $age hash referehence = { $thread_id => $age }; my (@aid, $last, $age, $date, $status, $tid) = (); for $tid (sort @$thread_id_list) { + next unless defined $rh->{ _articles }->{ $tid }; + # $last: get the latest one of article_id's (@aid) = split(/\s+/, $rh->{ _articles }->{ $tid }); $last = $aid[ $#aid ] || 0; |
