line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=============================================================================== |
2
|
|
|
|
|
|
|
# FILE: EpisodeListRequest.pm |
3
|
|
|
|
|
|
|
# AUTHOR: Kyle Brandt (mn), kyle@kbrandt.com , http://www.kbrandt.com |
4
|
|
|
|
|
|
|
# COMPANY: Home |
5
|
|
|
|
|
|
|
#=============================================================================== |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
24851
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package WebService::TVRage::EpisodeListRequest; |
11
|
1
|
|
|
1
|
|
825
|
use Mouse; |
|
1
|
|
|
|
|
31235
|
|
|
1
|
|
|
|
|
5
|
|
12
|
1
|
|
|
1
|
|
5953
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
135298
|
|
|
1
|
|
|
|
|
35
|
|
13
|
1
|
|
|
1
|
|
880
|
use HTTP::Request::Common; |
|
1
|
|
|
|
|
2106
|
|
|
1
|
|
|
|
|
106
|
|
14
|
1
|
|
|
1
|
|
391
|
use XML::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Data::Dumper; |
16
|
|
|
|
|
|
|
use WebService::TVRage::EpisodeList; |
17
|
|
|
|
|
|
|
has 'episodeID' => ( is => 'rw'); |
18
|
|
|
|
|
|
|
has 'URL' => ( is => 'rw', |
19
|
|
|
|
|
|
|
default => 'http://www.tvrage.com/feeds/episode_list.php?sid='); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub getEpisodeList { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
my $uA = LWP::UserAgent->new( timeout => 20); |
24
|
|
|
|
|
|
|
my $episodeListReq = HTTP::Request->new(GET => $self->URL . $self->episodeID); |
25
|
|
|
|
|
|
|
my $episodeListResponse = $uA->request($episodeListReq); |
26
|
|
|
|
|
|
|
print $episodeListResponse->error_as_HTML unless $episodeListResponse->is_success; |
27
|
|
|
|
|
|
|
my $xml = new XML::Simple; |
28
|
|
|
|
|
|
|
my $processedXML = $xml->XMLin( $episodeListResponse->decoded_content, (ForceArray => ['Season', 'episode'])); |
29
|
|
|
|
|
|
|
#return undef if ref $processedXML->{name}; |
30
|
|
|
|
|
|
|
return undef unless defined $processedXML->{Episodelist}; |
31
|
|
|
|
|
|
|
my $object = WebService::TVRage::EpisodeList->new(); |
32
|
|
|
|
|
|
|
$object->_episodeListHash($processedXML); |
33
|
|
|
|
|
|
|
return $object; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
WebService::TVRage::EpisodeListRequest - Requests A List of Episodes for a show using TVRage's XML Service |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $heroes = WebService::TVRage::EpisodeListRequest->new(); |
45
|
|
|
|
|
|
|
$heroes->episodeID('8172'); |
46
|
|
|
|
|
|
|
my $episodeList = $heroes->getEpisodeList(); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 Methods |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 new() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $heroes = WebService::TVRage::EpisodeListRequest->new( episodeID => '8172'); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Constructor object for creating a request to get episode information for the specified show. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 1 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item episodeID |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This is the TVRage's ID for ths show. Use WebService::TVRage::ShowSearchRequest to find out what the id of your show is. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item URL |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This is the TVRage URL that the request gets sent to, you shouldn't need to edit this. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 getEpisodeList() |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$heroes->getEpisodeList() |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Sends a request to TVRage for which ever show you specified with episodeID and returns a WebService::TVRage::EpisodeList object |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Kyle Brandt, kyle@kbrandt.com |
77
|
|
|
|
|
|
|
http://www.kbrandt.com |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|