| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package RSS::Video::Google; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1360
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
42
|
|
|
4
|
1
|
|
|
1
|
|
2436
|
use XML::Simple; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use RSS::Video::Google::Channel; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use constant GENERATOR => q{RSS::Video::Google}; |
|
9
|
|
|
|
|
|
|
use constant OPEN_SEARCH => q{http://a9.com/-/spec/opensearchrss/1.0/}; |
|
10
|
|
|
|
|
|
|
use constant VERSION => q{2.0}; |
|
11
|
|
|
|
|
|
|
use constant MEDIA => q{http://search.yahoo.com/mrss}; |
|
12
|
|
|
|
|
|
|
use constant XMLDECL => q{}; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use constant ROUTINES => [qw( |
|
15
|
|
|
|
|
|
|
new_channel |
|
16
|
|
|
|
|
|
|
version |
|
17
|
|
|
|
|
|
|
)]; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
|
|
|
|
|
|
my $class = shift; |
|
23
|
|
|
|
|
|
|
my %args = @_; |
|
24
|
|
|
|
|
|
|
my $self = bless {}, $class; |
|
25
|
|
|
|
|
|
|
foreach my $routine (keys %args) { |
|
26
|
|
|
|
|
|
|
if (grep(/^$routine$/, @{&ROUTINES})) { |
|
27
|
|
|
|
|
|
|
$self->$routine($args{$routine}); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
return $self; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new_channel { |
|
34
|
|
|
|
|
|
|
my $self = shift; |
|
35
|
|
|
|
|
|
|
my @args = @_; |
|
36
|
|
|
|
|
|
|
if (ref $args[0] eq 'HASH') { |
|
37
|
|
|
|
|
|
|
@args = %{$args[0]}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$self->channel(RSS::Video::Google::Channel->new(@args)); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub channel { |
|
44
|
|
|
|
|
|
|
my $self = shift; |
|
45
|
|
|
|
|
|
|
my $channel = shift; |
|
46
|
|
|
|
|
|
|
if (defined $channel && ref $channel eq 'RSS::Video::Google::Channel') { |
|
47
|
|
|
|
|
|
|
$self->{channel} = $channel; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
return $self->{channel}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub version { |
|
53
|
|
|
|
|
|
|
my $self = shift; |
|
54
|
|
|
|
|
|
|
$self->{version} = shift if $_[0]; |
|
55
|
|
|
|
|
|
|
return $self->{version} || VERSION; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub xmldecl { |
|
59
|
|
|
|
|
|
|
my $self = shift; |
|
60
|
|
|
|
|
|
|
$self->{xmldecl} = shift if $_[0]; |
|
61
|
|
|
|
|
|
|
return $self->{xmldecl} || XMLDECL; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub hashref { |
|
65
|
|
|
|
|
|
|
my $self = shift; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
return { |
|
68
|
|
|
|
|
|
|
rss => [{ |
|
69
|
|
|
|
|
|
|
channel => $self->channel->hashref, |
|
70
|
|
|
|
|
|
|
version => $self->version, |
|
71
|
|
|
|
|
|
|
'xmlns:openSearch' => OPEN_SEARCH, |
|
72
|
|
|
|
|
|
|
'xmlns:media' => MEDIA, |
|
73
|
|
|
|
|
|
|
}], |
|
74
|
|
|
|
|
|
|
}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub xml { |
|
78
|
|
|
|
|
|
|
my $self = shift; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $xs = XML::Simple->new( |
|
81
|
|
|
|
|
|
|
forcearray => 1, |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $xml = $xs->XMLout( |
|
85
|
|
|
|
|
|
|
$self->hashref, |
|
86
|
|
|
|
|
|
|
rootname => q{}, |
|
87
|
|
|
|
|
|
|
xmldecl => $self->xmldecl, |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return $xml; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
__END__ |