line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: News.pm 7370 2012-04-09 01:17:33Z chris $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
WebService::IMDB::News |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package WebService::IMDB::News; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
12
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
89
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
13
|
use base qw(Class::Accessor); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
162
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
195
|
|
19
|
|
|
|
|
|
|
our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Name); |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
1159
|
use WebService::IMDB::NewsItem; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
32
|
|
22
|
2
|
|
|
2
|
|
9485
|
use WebService::IMDB::NewsSource; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
16
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( |
25
|
|
|
|
|
|
|
limit |
26
|
|
|
|
|
|
|
start |
27
|
|
|
|
|
|
|
total |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
channel |
30
|
|
|
|
|
|
|
items |
31
|
|
|
|
|
|
|
label |
32
|
|
|
|
|
|
|
markup |
33
|
|
|
|
|
|
|
sources |
34
|
|
|
|
|
|
|
type |
35
|
|
|
|
|
|
|
)); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 channel |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 items |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 label |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 markup |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 sources |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 type |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _new { |
55
|
2
|
|
|
2
|
|
26
|
my $class = shift; |
56
|
2
|
|
|
|
|
5
|
my $ws = shift; |
57
|
2
|
50
|
|
|
|
12
|
my $data = shift or die; |
58
|
|
|
|
|
|
|
|
59
|
2
|
|
|
|
|
7
|
my $self = {}; |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
8
|
bless $self, $class; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
13
|
$self->limit($data->{'limit'}); |
64
|
2
|
|
|
|
|
54
|
$self->start($data->{'start'}); |
65
|
2
|
|
|
|
|
65
|
$self->total($data->{'total'}); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Needed for parsing items |
68
|
2
|
|
|
|
|
20
|
$self->sources( { map { $_ => WebService::IMDB::NewsSource->_new($ws, $data->{'sources'}->{$_}) } keys %{$data->{'sources'}} } ); |
|
30
|
|
|
|
|
134
|
|
|
2
|
|
|
|
|
17
|
|
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
31
|
$self->channel($data->{'channel'}); |
71
|
2
|
|
|
|
|
32
|
$self->items( [ map { WebService::IMDB::NewsItem->_new($ws, $_, $self->sources()) } @{$data->{'items'}} ] ); |
|
40
|
|
|
|
|
155
|
|
|
2
|
|
|
|
|
8
|
|
72
|
2
|
|
|
|
|
33
|
$self->label($data->{'label'}); |
73
|
2
|
|
|
|
|
24
|
$self->markup($data->{'markup'}); |
74
|
2
|
|
|
|
|
26
|
$self->type($data->{'@type'}); |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
|
|
31
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |