TVRage/ShowList.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 CC 2 SCAR 10.6
CC
2
Cov
0%
getShow
6.0
getTitleList
2.0
BEGIN
2.0
CRAP 2.9
1 #===============================================================================
2 # FILE: ShowList.pm
3 # AUTHOR: Kyle Brandt (mn), kyle@kbrandt.com , http://www.kbrandt.com
4 #===============================================================================
5  
6 use strict;
7 use warnings;
8  
9 package WebService::TVRage::ShowList;
10 use Mouse;
11 use WebService::TVRage::Episode;
12 use Data::Dumper;
13 use WebService::TVRage::Show;
14 has '_showListHash' => ( is => 'rw' );
15  
16 sub getTitleList {
17 my $self = shift;
18 my @titles;
19 for my $showTitle ( keys(%{ $self->_showListHash()->{show} }) ) {
20 push( @titles, $showTitle );
21 }
22 return @titles;
23 }
24  
25 sub getShow {
26 my $self = shift;
27 my $showTitle = shift;
28 my $object = WebService::TVRage::Show->new();
29 return undef unless defined $self->_showListHash()->{show}{$showTitle};
30 $object->_showHash( $self->_showListHash()->{show}{$showTitle} );
31 return $object;
32 }
33 1;
34  
35  
36 =head1 NAME
37  
38 WebService::TVRage::ShowList - Object returned by WebService::TVRage::ShowSearchRequest->search(), Contains a List of shows
39  
40 =head1 SYNOPSIS
41
42 my $heroesSearch = WebService::TVRage::ShowSearchRequest->new( showTitle => 'Heroes' );
43 my $showList = $heroesSearch->search();
44 foreach my $showtitle ($showList->getTitleList()) {
45 my $show = $showList->getTitle($showtitle);
46 print $show->getLink(), "\n";
47 }
48  
49 =head1 Methods
50  
51 =over 1
52  
53 =item _showListHash
54
55 This is populated by WebService::TVRage::ShowSearchRequest->search(), you shouldn't need to edit this, but you might want to look at it with Data::Dumper
56
57 =back
58  
59 =head2 getTitleList()
60  
61 $showList->getTitleList()
62  
63 Returns an array of strings where each string is the title of a show that matched the search from ShowSearchRequest
64  
65 =head2 getShow()
66  
67 $showList->getShow('Heroes')
68  
69 Returns a WebService::TVRage::Show object which represents details of the show with the title that was given as an argument to the method
70  
71 =head1 AUTHOR
72  
73 Kyle Brandt, kyle@kbrandt.com
74 http://www.kbrandt.com
75  
76 =cut