line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::GData::Feed; |
2
|
5
|
|
|
5
|
|
82058
|
use WebService::GData 'private'; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
26
|
|
3
|
5
|
|
|
5
|
|
39
|
use base 'WebService::GData::Node::Atom::FeedEntity'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
3640
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
2914
|
use WebService::GData::Node::OpenSearch::ItemsPerPage(); |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
105
|
|
6
|
5
|
|
|
5
|
|
3162
|
use WebService::GData::Node::OpenSearch::StartIndex(); |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
103
|
|
7
|
5
|
|
|
5
|
|
2780
|
use WebService::GData::Node::OpenSearch::TotalResults(); |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
2126
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.01_08; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub __init { |
12
|
2
|
|
|
2
|
|
5
|
my ($this,$params,$request) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
22
|
$this->SUPER::__init($params); |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
39
|
$this->{_items_per_page}=new WebService::GData::Node::OpenSearch::ItemsPerPage($this->{_feed}->{'openSearch$itemsPerPage'}); |
17
|
2
|
|
|
|
|
8
|
$this->_entity->child($this->{_items_per_page}); |
18
|
2
|
|
|
|
|
24
|
$this->{_start_index}=new WebService::GData::Node::OpenSearch::StartIndex($this->{_feed}->{'openSearch$startIndex'}); |
19
|
2
|
|
|
|
|
9
|
$this->_entity->child($this->{_start_index}); |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
26
|
$this->{_total_results}=new WebService::GData::Node::OpenSearch::TotalResults($this->{_feed}->{'openSearch$totalResults'}); |
22
|
2
|
|
|
|
|
9
|
$this->_entity->child($this->{_total_results}); |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
|
|
6
|
$this->{_request}= $request; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub total_items { |
29
|
2
|
|
|
2
|
1
|
4
|
my $this = shift; |
30
|
2
|
|
|
|
|
28
|
return $this->total_results; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub previous_link { |
34
|
2
|
|
|
2
|
1
|
4
|
my ($this) = @_; |
35
|
2
|
|
|
|
|
7
|
return $this->get_link('previous'); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub next_link { |
39
|
2
|
|
|
2
|
1
|
7
|
my ($this) = @_; |
40
|
2
|
|
|
|
|
22
|
return $this->get_link('next'); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#ok, i need to cleanup this mess... |
44
|
|
|
|
|
|
|
#entry works as a factory and loads the proper entry class |
45
|
|
|
|
|
|
|
sub entry { |
46
|
1
|
|
|
1
|
1
|
3
|
my ( $this, $wanted_class ) = @_; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
50
|
|
|
6
|
my $entries = $this->{_feed}->{entry} || []; |
49
|
1
|
50
|
|
|
|
32
|
$entries = [$entries] if ( ref($entries) ne 'ARRAY' ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#default to the base Entry class |
52
|
1
|
|
|
|
|
3
|
my $class = q[WebService::GData::Feed::Entry]; |
53
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
6
|
if ($wanted_class) { |
55
|
1
|
|
|
|
|
3
|
$class = $wanted_class; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
else { |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#from which service this request comes from... |
60
|
0
|
|
|
|
|
0
|
my $service = ref($this); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#what kind of feed is this?? |
63
|
0
|
|
|
|
|
0
|
my $feedType = $this->_get_feed_type; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
0
|
|
|
0
|
if ( $service =~ m/GData::(.*)::/ && $feedType ) { |
66
|
0
|
|
|
|
|
0
|
my ( $match, $ser ) = $service =~ m/GData::(.*)::/; |
67
|
0
|
|
|
|
|
0
|
$class = 'WebService::GData::' . $match . '::Feed::' . $feedType; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
{ |
71
|
5
|
|
|
5
|
|
33
|
no strict 'refs'; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
1202
|
|
|
1
|
|
|
|
|
1
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#all entries inherit from WebService::GData::Feed::Entry |
74
|
1
|
|
|
|
|
132
|
eval("use $class") |
75
|
1
|
50
|
|
1
|
|
3
|
if ( !@{ $class . '::ISA' } ); |
|
1
|
|
|
|
|
764
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
76
|
|
|
|
|
|
|
} |
77
|
1
|
|
|
|
|
4
|
my @ret = (); |
78
|
1
|
|
|
|
|
4
|
foreach my $entry (@$entries) { |
79
|
1
|
|
|
|
|
218
|
push @ret, $class->new( $entry, $this->{_request} ); |
80
|
|
|
|
|
|
|
} |
81
|
1
|
|
|
|
|
5
|
return \@ret; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
private _get_feed_type => sub { |
85
|
|
|
|
|
|
|
my $this = shift; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $feedTypeString = ''; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
if ( $this->{_category} || $this->{_feed}->{entry}->{category} ) { |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$feedTypeString = $this->{_category}->[0]->{term} |
92
|
|
|
|
|
|
|
|| $this->{_feed}->{entry}->{category}->[0]->{term}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#the feed type is after the anchor http://gdata.youtube.com/schemas/2007#video |
96
|
|
|
|
|
|
|
my $feedType = ( split( '#', $feedTypeString ) )[1]; |
97
|
|
|
|
|
|
|
$feedType = "\u$feedType"; #Uppercase to load the proper class |
98
|
|
|
|
|
|
|
return $feedType; |
99
|
|
|
|
|
|
|
}; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
"The earth is blue like an orange."; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |