| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
{ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
XML::Filter::XML_Directory_2RSS::Base - base class for XML::Filter::XML_Directory_2RSS |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package XML::Filter::XML_Directory_2RSS |
|
10
|
|
|
|
|
|
|
use base qw (XML::Filter::XML_Directory_2RSS::Base); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Base class for XML::Filter::XML_Directory_2RSS and XML::Filter::XML_Directory_2RSS::Items |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This is used internally by XML::Filter::XML_Directory_2RSS. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package XML::Filter::XML_Directory_2RSS::Base; |
|
21
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
37
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$XML::Filter::XML_Directory_2RSS::Base::VERSION = 0.9.1; |
|
24
|
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
68
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
4
|
use base qw (XML::Filter::XML_Directory_Pruner); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
924
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
14820
|
use constant DEFAULT_NS => ( "","rdf","dc","thr" ); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
109
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
1396
|
use constant NS => { |
|
32
|
|
|
|
|
|
|
"" => "http://purl.org/rss/1.0/", |
|
33
|
|
|
|
|
|
|
"admin" => "http://webns.net/mvcb/", |
|
34
|
|
|
|
|
|
|
"dc" => "http://purl.org/dc/elements/1.1/", |
|
35
|
|
|
|
|
|
|
"rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", |
|
36
|
|
|
|
|
|
|
"sy" => "http://purl.org/rss/1.0/modules/syndication/", |
|
37
|
|
|
|
|
|
|
"ti" => "http://purl.org/rss/1.0/modules/textinput/", |
|
38
|
|
|
|
|
|
|
"thr" => "http://purl.org/rss/1.0/modules/threading/", |
|
39
|
1
|
|
|
1
|
|
6
|
}; |
|
|
1
|
|
|
|
|
4
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub start_default_namespaces { |
|
42
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
43
|
0
|
|
|
|
|
|
foreach my $prefix (DEFAULT_NS) { |
|
44
|
0
|
|
|
|
|
|
$self->SUPER::start_prefix_mapping({ |
|
45
|
|
|
|
|
|
|
Prefix => $prefix, |
|
46
|
|
|
|
|
|
|
NamespaceURI => NS->{$prefix}, |
|
47
|
|
|
|
|
|
|
}); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return 1; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub end_default_namespaces { |
|
54
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
55
|
0
|
|
|
|
|
|
foreach my $prefix (DEFAULT_NS) { |
|
56
|
0
|
|
|
|
|
|
$self->SUPER::end_prefix_mapping({Prefix => $prefix}); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return 1; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub handlers { |
|
63
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
64
|
0
|
|
|
|
|
|
my $args = shift; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if (ref($args) ne "HASH") { |
|
67
|
0
|
|
|
|
|
|
return undef; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
foreach ("title","description") { |
|
71
|
0
|
0
|
|
|
|
|
next if (! $args->{$_}); |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
if (! UNIVERSAL::isa($args->{$_},"XML::SAX::Base")) { |
|
74
|
0
|
|
|
|
|
|
carp "Handler must be derived from XML::SAX::Base"; |
|
75
|
0
|
|
|
|
|
|
next; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
if (! UNIVERSAL::can($args->{$_},"parse_uri")) { |
|
79
|
0
|
|
|
|
|
|
carp "Handler must define a 'parse_uri' method.\n"; |
|
80
|
0
|
|
|
|
|
|
next; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->{'__handlers'}{$_} = $args->{$_}; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return 1; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub callbacks { |
|
90
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
91
|
0
|
|
|
|
|
|
my $args = shift; |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
if (ref($args) ne "HASH") { |
|
94
|
0
|
|
|
|
|
|
return undef; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
foreach ("title","link","description") { |
|
98
|
0
|
0
|
|
|
|
|
next if (! $args->{$_}); |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
if (ref($args->{$_}) ne "CODE") { |
|
101
|
0
|
|
|
|
|
|
carp "Not a CODE reference"; |
|
102
|
0
|
|
|
|
|
|
return undef; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
$self->{'__callbacks'}{$_} = $args->{$_}; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return 1; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub on_enter_start_element { |
|
112
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
113
|
0
|
|
|
|
|
|
my $data = shift; |
|
114
|
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
$self->{'__rlevel'} ++; |
|
116
|
0
|
|
|
|
|
|
$self->{'__last'} = $data->{Name}; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
if ($data->{Name} eq "head") { |
|
119
|
0
|
|
|
|
|
|
$self->{'__head'} = 1; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
0
|
0
|
|
|
|
if (($self->{'__head'}) && ($data->{Name} eq "orderby")) { |
|
123
|
0
|
|
|
|
|
|
$self->{'__orderby'} = $data->{'Attributes'}->{'{}code'}->{'Value'}; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
0
|
0
|
|
|
|
if ((! $self->{'__start'}) && ($data->{Name} eq "directory")) { |
|
127
|
0
|
|
|
|
|
|
$self->{'__start'} = $self->{'__rlevel'}; |
|
128
|
0
|
|
|
|
|
|
return; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
0
|
|
|
|
|
return unless $self->{'__start'}; |
|
132
|
|
|
|
|
|
|
|
|
133
|
0
|
0
|
0
|
|
|
|
if (($data->{'Name'} =~ /^(file|directory)$/) && (! $self->{'__skip'})) { |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
$self->{'__wasa'} = $self->{'__ima'}; |
|
136
|
0
|
|
|
|
|
|
$self->{'__wasa_level'} = $self->{'__ima_level'}; |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
$self->{'__ima'} = $1; |
|
139
|
0
|
|
|
|
|
|
$self->{'__ima_level'} = $self->{'__rlevel'}; |
|
140
|
0
|
|
|
|
|
|
$self->_compare($data->{Attributes}->{'{}name'}->{Value}); |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
0
|
|
|
|
|
if ($self->{'__skip'}) { |
|
144
|
0
|
|
|
|
|
|
return 0; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
$self->grow_cwd($data); |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return 1; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub on_enter_end_element { |
|
153
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
154
|
0
|
|
|
|
|
|
my $data = shift; |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
0
|
|
|
|
|
if ($data->{Name} eq "head") { |
|
157
|
0
|
|
|
|
|
|
$self->{'__head'} = 0; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
return 1; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub on_exit_end_element { |
|
164
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
165
|
0
|
|
|
|
|
|
my $data = shift; |
|
166
|
|
|
|
|
|
|
|
|
167
|
0
|
0
|
|
|
|
|
if ($self->{'__skip'} == $self->{'__rlevel'}) { |
|
168
|
0
|
|
|
|
|
|
$self->{'__skip'} = 0; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
$self->{'__rlevel'} --; |
|
172
|
0
|
|
|
|
|
|
return 1; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub on_characters { |
|
176
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
177
|
0
|
|
|
|
|
|
my $data = shift; |
|
178
|
|
|
|
|
|
|
|
|
179
|
0
|
0
|
|
|
|
|
if ($self->{'__head'}) { |
|
180
|
0
|
|
|
|
|
|
$self->{ '__'.$self->{'__last'} } = $data->{Data}; |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
return 1; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub grow_cwd { |
|
187
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
188
|
0
|
|
|
|
|
|
my $data = shift; |
|
189
|
|
|
|
|
|
|
|
|
190
|
0
|
0
|
|
|
|
|
if ($data->{Name} eq "directory") { |
|
191
|
0
|
|
|
|
|
|
$self->{'__cwd'} .= "/$data->{Attributes}->{'{}name'}->{Value}"; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
return 1; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub prune_cwd { |
|
198
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
199
|
0
|
|
|
|
|
|
my $data = shift; |
|
200
|
|
|
|
|
|
|
|
|
201
|
0
|
0
|
|
|
|
|
if ($data->{Name} eq "directory") { |
|
202
|
0
|
|
|
|
|
|
$self->{'__cwd'} =~ s/^(.*)\/([^\/]+)$/$1/; |
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
return 1; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub build_uri { |
|
209
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
210
|
0
|
|
|
|
|
|
my $data = shift; |
|
211
|
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
my $uri = $self->{'__path'}.$self->{'__cwd'}; |
|
213
|
|
|
|
|
|
|
|
|
214
|
0
|
0
|
|
|
|
|
if ($data->{Name} eq "file") { |
|
215
|
0
|
|
|
|
|
|
$uri .= "/$data->{Attributes}->{'{}name'}->{Value}"; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
return $uri; |
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub make_link { |
|
222
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
223
|
0
|
|
|
|
|
|
my $data = shift; |
|
224
|
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
my $link = $self->build_uri($data); |
|
226
|
|
|
|
|
|
|
|
|
227
|
0
|
0
|
|
|
|
|
if ($self->{'__callbacks'}{'link'}) { |
|
228
|
0
|
|
|
|
|
|
$link = &{$self->{'__callbacks'}{'link'}}($link); |
|
|
0
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
return $link; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub ns_map { |
|
235
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
236
|
0
|
|
|
|
|
|
my $prefix = shift; |
|
237
|
0
|
|
|
|
|
|
return NS->{$prefix}; |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
sub rdf_resource { |
|
241
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
242
|
0
|
|
|
|
|
|
my $resource = shift; |
|
243
|
|
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
|
my $ns = NS->{"rdf"}; |
|
245
|
|
|
|
|
|
|
|
|
246
|
0
|
|
|
|
|
|
return {"{$ns}rdf:resource" => { |
|
247
|
|
|
|
|
|
|
Name => "rdf:resource", |
|
248
|
|
|
|
|
|
|
Value => $resource, |
|
249
|
|
|
|
|
|
|
Prefix => "rdf", |
|
250
|
|
|
|
|
|
|
LocalName => "resource", |
|
251
|
|
|
|
|
|
|
NamespaceURI => $ns, |
|
252
|
|
|
|
|
|
|
}}; |
|
253
|
|
|
|
|
|
|
} |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub rdf_about { |
|
256
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
257
|
0
|
|
|
|
|
|
my $subject = shift; |
|
258
|
|
|
|
|
|
|
|
|
259
|
0
|
|
|
|
|
|
my $ns = NS->{"rdf"}; |
|
260
|
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
return {"{$ns}rdf:about" => { |
|
262
|
|
|
|
|
|
|
Name => "rdf:about", |
|
263
|
|
|
|
|
|
|
Value => $subject, |
|
264
|
|
|
|
|
|
|
Prefix => "rdf", |
|
265
|
|
|
|
|
|
|
LocalName => "about", |
|
266
|
|
|
|
|
|
|
NamespaceURI => $ns, |
|
267
|
|
|
|
|
|
|
}}; |
|
268
|
|
|
|
|
|
|
} |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head1 VERSION |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
0.9.1 |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head1 DATE |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
May 24, 2002 |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head1 AUTHOR |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Aaron Straup Cope |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
L |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 LICENSE |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
Copright (c) 2002, Aaron Straup Cope. All Rights Reserved. |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
This is free software, you may use it and distribute it under the same terms as Perl itself. |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=cut |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
return 1; |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
} |