| 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 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 2 | our $VERSION = '0.05'; | |||||||||
| 15 | |||||||||||
| 16 | 2 | ▶ | use base qw(Class::Accessor); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Name); | |||||||||
| 20 | |||||||||||
| 21 | 2 | ▶ | use WebService::IMDB::NewsItem; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 2 | ▶ | use WebService::IMDB::NewsSource; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 2 | __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 | 0 | ▶ | sub _new { | ||||||||
|
Subroutine
_new: not called CC=2 SCAR=17.9
| |||||||||||
| 55 | 0 | my $class = shift; | |||||||||
| 56 | 0 | my $ws = shift; | |||||||||
| 57 | 0 | ▶ | my $data = shift or die; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | |||||||||||
| 59 | 0 | my $self = {}; | |||||||||
| 60 | |||||||||||
| 61 | 0 | bless $self, $class; | |||||||||
| 62 | |||||||||||
| 63 | 0 | $self->limit($data->{'limit'}); | |||||||||
| 64 | 0 | $self->start($data->{'start'}); | |||||||||
| 65 | 0 | $self->total($data->{'total'}); | |||||||||
| 66 | |||||||||||
| 67 | # Needed for parsing items | ||||||||||
| 68 | 0 | $self->sources( { map { $_ => WebService::IMDB::NewsSource->_new($ws, $data->{'sources'}->{$_}) } keys %{$data->{'sources'}} } ); | |||||||||
| 69 | |||||||||||
| 70 | 0 | $self->channel($data->{'channel'}); | |||||||||
| 71 | 0 | $self->items( [ map { WebService::IMDB::NewsItem->_new($ws, $_, $self->sources()) } @{$data->{'items'}} ] ); | |||||||||
| 72 | 0 | $self->label($data->{'label'}); | |||||||||
| 73 | 0 | $self->markup($data->{'markup'}); | |||||||||
| 74 | 0 | $self->type($data->{'@type'}); | |||||||||
| 75 | |||||||||||
| 76 | 0 | return $self; | |||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | 2 | 1; | |||||||||