line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Atom::Syndication::Thing; |
2
|
22
|
|
|
22
|
|
231
|
use strict; |
|
22
|
|
|
|
|
110
|
|
|
22
|
|
|
|
|
991
|
|
3
|
|
|
|
|
|
|
|
4
|
22
|
|
|
22
|
|
145
|
use base qw( XML::Atom::Syndication::Object ); |
|
22
|
|
|
|
|
44
|
|
|
22
|
|
|
|
|
12950
|
|
5
|
22
|
|
|
22
|
|
202
|
use Symbol; |
|
22
|
|
|
|
|
54
|
|
|
22
|
|
|
|
|
2109
|
|
6
|
|
|
|
|
|
|
|
7
|
22
|
|
|
22
|
|
165
|
use XML::Elemental; |
|
22
|
|
|
|
|
45
|
|
|
22
|
|
|
|
|
19029
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Person', |
10
|
|
|
|
|
|
|
'author', 'contributor'); |
11
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Link', |
12
|
|
|
|
|
|
|
'link'); |
13
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Category', |
14
|
|
|
|
|
|
|
'category'); |
15
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Text', |
16
|
|
|
|
|
|
|
'rights', 'title'); |
17
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('element', 'id', 'updated'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init { |
20
|
202
|
|
|
202
|
0
|
359
|
my $thing = shift; |
21
|
202
|
100
|
|
|
|
1262
|
my %param = @_ == 1 ? (Stream => $_[0]) : @_; |
22
|
202
|
|
|
|
|
1261
|
$thing->set_ns(\%param); |
23
|
202
|
100
|
|
|
|
672
|
if (%param) { |
24
|
191
|
100
|
|
|
|
749
|
if (my $stream = $param{Stream}) { |
|
|
50
|
|
|
|
|
|
25
|
113
|
|
|
|
|
928
|
my $parser = XML::Elemental->parser; |
26
|
113
|
50
|
33
|
|
|
2503352
|
if (ref($stream) eq 'SCALAR') { |
|
|
50
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
$thing->{doc} = $parser->parse_string($$stream); |
28
|
|
|
|
|
|
|
} elsif (ref $stream eq 'GLOB' || !ref($stream)) { |
29
|
113
|
|
|
|
|
226
|
my $xml; |
30
|
|
|
|
|
|
|
my $fh; |
31
|
113
|
50
|
|
|
|
399
|
unless (ref $stream eq 'GLOB') { |
32
|
0
|
|
|
|
|
0
|
$fh = gensym(); |
33
|
0
|
0
|
|
|
|
0
|
open $fh, $stream or die $!; |
34
|
|
|
|
|
|
|
} else { |
35
|
113
|
|
|
|
|
245
|
$fh = $stream; |
36
|
|
|
|
|
|
|
} |
37
|
113
|
|
|
|
|
189
|
{ local $/; $xml = <$fh>; } |
|
113
|
|
|
|
|
576
|
|
|
113
|
|
|
|
|
3992
|
|
38
|
113
|
50
|
|
|
|
453
|
close $fh unless (ref $stream eq 'GLOB'); |
39
|
113
|
|
|
|
|
1059
|
$thing->{doc} = $parser->parse_string($xml); |
40
|
|
|
|
|
|
|
} else { |
41
|
0
|
|
|
|
|
0
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
113
|
|
|
|
|
442084
|
$thing->{elem} = $thing->{doc}->contents->[0]; |
44
|
|
|
|
|
|
|
} elsif ($param{Elem}) { |
45
|
78
|
|
|
|
|
209
|
$thing->{elem} = $param{Elem}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} else { |
48
|
11
|
|
|
|
|
4418
|
require XML::Elemental::Element; |
49
|
11
|
|
|
|
|
2655
|
$thing->{elem} = XML::Elemental::Element->new; |
50
|
11
|
|
|
|
|
199
|
$thing->{elem}->name('{' . $thing->ns . '}' . $thing->element_name); |
51
|
|
|
|
|
|
|
} |
52
|
202
|
|
|
|
|
7611
|
$thing; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub inner_atom { |
56
|
3
|
|
|
3
|
0
|
2593
|
my ($thing, $str) = @_; |
57
|
3
|
|
|
|
|
15
|
my $name = $thing->element_name; |
58
|
3
|
|
|
|
|
28
|
my $ns = $thing->ns; |
59
|
3
|
|
|
|
|
26
|
my $parser = XML::Elemental->parser; |
60
|
3
|
|
|
|
|
2581
|
my $doc = $parser->parse_string("<$name xmlns='$ns'>$str$name>"); |
61
|
3
|
|
|
|
|
7042
|
my $pseudo = $doc->contents->[0]; |
62
|
3
|
|
|
|
|
58
|
my $parent = $thing->elem; |
63
|
3
|
|
|
|
|
8
|
$_->parent($parent) for @{$pseudo->contents}; |
|
3
|
|
|
|
|
13
|
|
64
|
3
|
|
|
|
|
69
|
$parent->contents($pseudo->contents); |
65
|
3
|
|
|
|
|
141
|
$pseudo->contents([]); |
66
|
3
|
|
|
|
|
101
|
1; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |