| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::VieDeMerde::Message; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1862
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
38
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
89
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4948
|
use XML::Twig; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=encoding utf8 |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
WWW::VieDeMerde::Message - A message from VieDeMerde.fr |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.21 |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.21'; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use WWW::VieDeMerde; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $toto = WWW::VieDeMerde->new(); |
|
28
|
|
|
|
|
|
|
my $tata = $toto->get(1664); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
print $tata->text, $tata->author; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
You should first read the documentation L ! |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
A WWW::VieDeMerde::Message object describes a fmylife or viedemerde item. You probably do not need to create yourself such object, L manage it. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The following accessors are useful: |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over 4 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * id |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * author |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * category |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item * date |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item * agree |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * deserved |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item * comments |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
It's the number of commentaries |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * text |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * comments_flag |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=back |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 new |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Create a new WWW::VieDeMerde::Message given a vdm node the xml response to a query. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub new { |
|
73
|
|
|
|
|
|
|
my $class = shift; |
|
74
|
|
|
|
|
|
|
my $t = shift; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $self = {}; |
|
77
|
|
|
|
|
|
|
bless($self, $class); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
$self->{id} = $t->att('id'); |
|
80
|
|
|
|
|
|
|
foreach ($t->children()) { |
|
81
|
|
|
|
|
|
|
my $tag = $_->tag; |
|
82
|
|
|
|
|
|
|
$self->{$tag} = $_->text; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
return $self; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 parse |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Take an xml tree and return a list of WWW::VieDeMerde::Message. |
|
92
|
|
|
|
|
|
|
qu'il contient. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#' |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub parse { |
|
99
|
|
|
|
|
|
|
my $class = shift; |
|
100
|
|
|
|
|
|
|
my $t = shift; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my $root = $t->root; |
|
103
|
|
|
|
|
|
|
my $vdms = $root->first_child('items'); |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my @vdm = $vdms->children('item'); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my @result = (); |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
foreach (@vdm) { |
|
110
|
|
|
|
|
|
|
my $m = WWW::VieDeMerde::Message->new($_); |
|
111
|
|
|
|
|
|
|
push @result, $m; |
|
112
|
|
|
|
|
|
|
# print $m->{auteur}, ", "; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# marche pas ????? |
|
116
|
|
|
|
|
|
|
# return map(WWW::VieDeMerde::Message->new, @vdm); |
|
117
|
|
|
|
|
|
|
return @result; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# read-only accessors |
|
121
|
|
|
|
|
|
|
for my $attr (qw(id author category date agree deserved |
|
122
|
|
|
|
|
|
|
comments comments_flag text )) { |
|
123
|
|
|
|
|
|
|
no strict 'refs'; |
|
124
|
|
|
|
|
|
|
*{"WWW::VieDeMerde::Message::$attr"} = sub { $_[0]{$attr} } |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Olivier Schwander, C<< >> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 BUGS |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Please report any bugs or feature requests to C
|
|
134
|
|
|
|
|
|
|
rt.cpan.org>, or through the web interface at |
|
135
|
|
|
|
|
|
|
L. I will |
|
136
|
|
|
|
|
|
|
be notified, and then you'll automatically be notified of progress on |
|
137
|
|
|
|
|
|
|
your bug as I make changes. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SUPPORT |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
perldoc WWW::VieDeMerde |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
You can also look for information at: |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over 4 |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * Search CPAN |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=back |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Copyright 2008 Olivier Schwander, all rights reserved. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
180
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
1; # End of WWW::VieDeMerde |