| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Topica::Index; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
293
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=pod |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
WWW::Topica::Index - parse a single Topic mailing list index |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $index = WWW::Topic::Index->new($index_html); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
foreach my $mess_id ($index->message_ids) { |
|
16
|
|
|
|
|
|
|
# the mail has some information and also provides a link to the reply ... |
|
17
|
|
|
|
|
|
|
my $mail = WWW::Topica::Mail->new($topica->fetch_mail($mess_id), $mess_id); |
|
18
|
|
|
|
|
|
|
# which has other information (like the un-htmled mail and the email address) ... |
|
19
|
|
|
|
|
|
|
my $reply = WWW::Topica::Reply->new($topica->fetch_reply($mail->id, $mail->eto), $mail->id, $mail->eto); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
print "Next offset is ".$index->next."\n"; |
|
23
|
|
|
|
|
|
|
print "Previous offset is ".$index->prev."\n"; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Used to parse a single index page from Topica.com's mailing list indexes. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 METHODS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 new |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
|
40
|
3
|
|
|
3
|
1
|
318
|
my ($class, $html) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
7
|
my $self = { }; |
|
43
|
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
25
|
bless $self, $class; |
|
45
|
|
|
|
|
|
|
|
|
46
|
3
|
|
|
|
|
16
|
$self->parse($html); |
|
47
|
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
40
|
return $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 parse |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Parse the html to get message ids and next & prev offsets. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub parse { |
|
59
|
3
|
|
|
3
|
1
|
6
|
my ($self, $html) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
10
|
my $list = $self->{list}; |
|
63
|
3
|
|
|
|
|
103
|
($self->{prev}) = ( $html =~ m!
|
|
64
|
|
|
|
|
|
|
|
|
65
|
3
|
|
|
|
|
112
|
($self->{next}) = ( $html =~ m!
|
|
66
|
|
|
|
|
|
|
|
|
67
|
3
|
|
|
|
|
520
|
my (@message_ids) = ($html =~ m!/lists/[^/]+/read/message\.html\?mid\=(\d+)!gs); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
18
|
$self->{_message_ids} = \@message_ids; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 message_ids |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Return all the messge ids found on the page |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub message_ids { |
|
82
|
3
|
|
|
3
|
1
|
8
|
my $self = shift; |
|
83
|
3
|
|
|
|
|
3
|
return @{$self->{_message_ids}}; |
|
|
3
|
|
|
|
|
32
|
|
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 prev |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Return the offset of the previous page or undef if there is none. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub prev { |
|
93
|
3
|
|
|
3
|
1
|
15
|
return $_[0]->{prev}; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 next |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Return the offset of the next page or undef if there is none. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub next { |
|
104
|
3
|
|
|
3
|
1
|
11
|
return $_[0]->{next}; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
1; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Simon Wistow |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright (c) 2004, Simon Wistow |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|