| 1 | #=============================================================================== | ||||||||||||
| 2 | # FILE: EpisodeList.pm | ||||||||||||
| 3 | # AUTHOR: Kyle Brandt (mn), kyle@kbrandt.com , http://www.kbrandt.com | ||||||||||||
| 4 | # COMPANY: Home | ||||||||||||
| 5 | #=============================================================================== | ||||||||||||
| 6 | |||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | package WebService::TVRage::EpisodeList; | ||||||||||||
| 11 | 1 | ▶ | use Mouse; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 1 | ▶ | use WebService::TVRage::Episode; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | 1 | ▶ | use Data::Dumper; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | 1 | has '_episodeListHash' => ( is => 'rw' ); | |||||||||||
| 15 | |||||||||||||
| 16 | 0 | ▶ | sub getNumSeasons { | ||||||||||
|
Subroutine
getNumSeasons: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 17 | 0 | my $self = shift; | |||||||||||
| 18 | 0 | ▶ | my $noSeasons = $self->_episodeListHash()->{totalseasons} // ''; | ||||||||||
|
Condition0%0/2
$self->_episodeListHash->{"totalseasons"} // ""
MC/DC0%0/1
$self->_episodeListHash->{"totalseasons"} // ""
$self->_episodeListHash->{"totalseasons"}
Truth table0%0/2
A
A= $self->_episodeListHash->{"totalseasons"}
| |||||||||||||
| 19 | 0 | return $noSeasons; | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | 0 | ▶ | sub getNumEpsInSeason { | ||||||||||
|
Subroutine
getNumEpsInSeason: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||
| 24 | 0 | my $season = shift; | |||||||||||
| 25 | 0 | $season -= 1; | |||||||||||
| 26 | 0 | ▶ | return 0 unless defined $self->_episodeListHash()->{Episodelist}{Season}[$season]; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | 0 | ▶ | my $noEps = @{$self->_episodeListHash()->{Episodelist}{Season}[$season]{episode}} // ''; | ||||||||||
|
Condition0%0/2
@{$self->_episodeListHash->{"Episodelist"}{"Season"}[$season]{"episode"};} // ""
MC/DC0%0/1
@{$self->_episodeListHash->{"Episodelist"}{"Season"}[$season]{"episode"};} // ""
@{$self->_episodeListHash->{"Episodelist"}{"Season"}[$season]{"episode"};}
Truth table0%0/2
A
A= @{$self->_episodeListHash->{"Episodelist"}{"Season"}[$season]{"episode"};}
| |||||||||||||
| 28 | 0 | return $noEps; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub getEpisode { | ||||||||||
|
Subroutine
getEpisode: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 32 | 0 | my $self = shift; | |||||||||||
| 33 | 0 | my $season = shift; | |||||||||||
| 34 | 0 | my $episode = shift; | |||||||||||
| 35 | 0 | $episode--; $season--; | |||||||||||
| 36 | 0 | my $object = WebService::TVRage::Episode->new(); | |||||||||||
| 37 | 0 | ▶ | return undef unless defined $self->_episodeListHash()->{Episodelist}{Season}[$season]{episode}[$episode]; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | 0 | $object->_episodeHash($self->_episodeListHash()->{Episodelist}{Season}[$season]{episode}[$episode]); | |||||||||||
| 39 | 0 | return $object; | |||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 1 | 1; | |||||||||||
| 43 | |||||||||||||
| 44 | =head1 NAME | ||||||||||||
| 45 | |||||||||||||
| 46 | WebService::TVRage::EpisodeList - Object returned by WebService::TVRage::EpisodeListRequest, Contains a List of episodes for all seasons | ||||||||||||
| 47 | |||||||||||||
| 48 | =head1 SYNOPSIS | ||||||||||||
| 49 | |||||||||||||
| 50 | my $heroes = WebService::TVRage::EpisodeListRequest->new(); | ||||||||||||
| 51 | $heroes->episodeID('8172'); | ||||||||||||
| 52 | my $episodeList = $heroes->getEpisodeList(); | ||||||||||||
| 53 | $episodeList->getNumSeasons(); | ||||||||||||
| 54 | |||||||||||||
| 55 | =head1 Methods | ||||||||||||
| 56 | |||||||||||||
| 57 | =over 1 | ||||||||||||
| 58 | |||||||||||||
| 59 | =item _episodeListHash | ||||||||||||
| 60 | |||||||||||||
| 61 | This is populated by WebService::TVRage::EpisodeListRequest, you shouldn't need to edit this, but you might want to look at it with Data::Dumper | ||||||||||||
| 62 | |||||||||||||
| 63 | =back | ||||||||||||
| 64 | |||||||||||||
| 65 | =head2 getNumSeasons() | ||||||||||||
| 66 | |||||||||||||
| 67 | $episodeList->getNumSeasons() | ||||||||||||
| 68 | |||||||||||||
| 69 | Returns the number of Seasons there have been for the show. | ||||||||||||
| 70 | |||||||||||||
| 71 | =head2 getNumEpsInSeasons() | ||||||||||||
| 72 | |||||||||||||
| 73 | $episodeList->getNumSeasons('2') | ||||||||||||
| 74 | |||||||||||||
| 75 | Returns the number of episodes for whatever season is specified as an argument. | ||||||||||||
| 76 | |||||||||||||
| 77 | =head2 getEpisode() | ||||||||||||
| 78 | |||||||||||||
| 79 | $episodeList->getEpisode(1,3) | ||||||||||||
| 80 | |||||||||||||
| 81 | Takes two arguments, season then Episode number and returns a WebService::TVRage::Episode object for that episode. | ||||||||||||
| 82 | |||||||||||||
| 83 | =head1 AUTHOR | ||||||||||||
| 84 | |||||||||||||
| 85 | Kyle Brandt, kyle@kbrandt.com | ||||||||||||
| 86 | http://www.kbrandt.com | ||||||||||||
| 87 | |||||||||||||
| 88 | |||||||||||||
| 89 | =cut | ||||||||||||