line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Atom::Syndication::Thing; |
2
|
21
|
|
|
21
|
|
116
|
use strict; |
|
21
|
|
|
|
|
31
|
|
|
21
|
|
|
|
|
722
|
|
3
|
|
|
|
|
|
|
|
4
|
21
|
|
|
21
|
|
103
|
use base qw( XML::Atom::Syndication::Object ); |
|
21
|
|
|
|
|
36
|
|
|
21
|
|
|
|
|
7488
|
|
5
|
21
|
|
|
21
|
|
117
|
use Symbol; |
|
21
|
|
|
|
|
30
|
|
|
21
|
|
|
|
|
7398
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Person', |
8
|
|
|
|
|
|
|
'author', 'contributor'); |
9
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Link', |
10
|
|
|
|
|
|
|
'link'); |
11
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Category', |
12
|
|
|
|
|
|
|
'category'); |
13
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('XML::Atom::Syndication::Text', |
14
|
|
|
|
|
|
|
'rights', 'title'); |
15
|
|
|
|
|
|
|
XML::Atom::Syndication::Thing->mk_accessors('element', 'id', 'updated'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub init { |
18
|
197
|
|
|
197
|
0
|
204
|
my $thing = shift; |
19
|
197
|
100
|
|
|
|
656
|
my %param = @_ == 1 ? (Stream => $_[0]) : @_; |
20
|
197
|
|
|
|
|
591
|
$thing->set_ns(\%param); |
21
|
197
|
100
|
|
|
|
326
|
if (%param) { |
22
|
186
|
100
|
|
|
|
412
|
if (my $stream = $param{Stream}) { |
|
|
50
|
|
|
|
|
|
23
|
110
|
|
|
|
|
538
|
my $parser = XML::Elemental->parser; |
24
|
110
|
50
|
33
|
|
|
1075427
|
if (ref($stream) eq 'SCALAR') { |
|
|
50
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
$thing->{doc} = $parser->parse_string($$stream); |
26
|
|
|
|
|
|
|
} elsif (ref $stream eq 'GLOB' || !ref($stream)) { |
27
|
110
|
|
|
|
|
141
|
my $xml; |
28
|
|
|
|
|
|
|
my $fh; |
29
|
110
|
50
|
|
|
|
215
|
unless (ref $stream eq 'GLOB') { |
30
|
0
|
|
|
|
|
0
|
$fh = gensym(); |
31
|
0
|
0
|
|
|
|
0
|
open $fh, $stream or die $!; |
32
|
|
|
|
|
|
|
} else { |
33
|
110
|
|
|
|
|
122
|
$fh = $stream; |
34
|
|
|
|
|
|
|
} |
35
|
110
|
|
|
|
|
113
|
{ local $/; $xml = <$fh>; } |
|
110
|
|
|
|
|
320
|
|
|
110
|
|
|
|
|
2181
|
|
36
|
110
|
50
|
|
|
|
319
|
close $fh unless (ref $stream eq 'GLOB'); |
37
|
110
|
|
|
|
|
511
|
$thing->{doc} = $parser->parse_string($xml); |
38
|
|
|
|
|
|
|
} else { |
39
|
0
|
|
|
|
|
0
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
110
|
|
|
|
|
224816
|
$thing->{elem} = $thing->{doc}->contents->[0]; |
42
|
|
|
|
|
|
|
} elsif ($param{Elem}) { |
43
|
76
|
|
|
|
|
95
|
$thing->{elem} = $param{Elem}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} else { |
46
|
11
|
|
|
|
|
1743
|
require XML::Elemental::Element; |
47
|
11
|
|
|
|
|
1392
|
$thing->{elem} = XML::Elemental::Element->new; |
48
|
11
|
|
|
|
|
138
|
$thing->{elem}->name('{' . $thing->ns . '}' . $thing->element_name); |
49
|
|
|
|
|
|
|
} |
50
|
197
|
|
|
|
|
2893
|
$thing; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |