Kyle Brandt

Original computing and productivity articles by a Linux administrator

A Perl API for TVRage – WebService::TVRage

The Module
This new module I have written provides an object oriented interface to TVRage’s XML service which allows you to get episode and other information for television shows. It is written very similarly to my previous module, WebService::UPS, and also uses XML::Simple and Mouse. You can get the module from CPAN here. You can also install it with ’sudo cpan -i WebService::TVRage’.

Example:

use WebService::TVRage::EpisodeListRequest;
use WebService::TVRage::ShowSearchRequest;

my $searchReq =   WebService::TVRage::ShowSearchRequest->new();
my $searchResults = $searchReq->search('Heroes');
my $heroFromSearch = $searchResults->getShow('Heroes');
print $heroFromSearch->getLink(), "\n";
print $heroFromSearch->getCountry(), "\n";
print $heroFromSearch->getStatus(), "\n";
my $heroes =  WebService::TVRage::EpisodeListRequest->new( 'episodeID' => $heroFromSearch->getShowID() );
my $episodeList = $heroes->getEpisodeList();
print $episodeList->getNumSeasons(), "\n";
my $episode = $episodeList->getEpisode(1,3);
print $episode->getTitle(), "\n";
print $episode->getAirDate(), "\n";
foreach my $showtitle ($searchResults->getTitleList()) {
   my $show = $searchResults->getShow($showtitle);
   print $show->getLink();
}

with 2 comments

April 8th, 2009 at 5:38 am

Posted in Perl, Programming

Tagged with ,

2 Responses to 'A Perl API for TVRage – WebService::TVRage'

Subscribe to comments with RSS or TrackBack to 'A Perl API for TVRage – WebService::TVRage'.

  1. I’ve installed the module and dependencies but get the following error:

    Attempt to bless into a reference at /usr/sec/bruin/local/share/perl/5.10.0/Mouse/Object.pm line 13.

    Kees de Bruin

    24 Jul 09 at 1:19 am

  2. Can you post your code that is causing this error? I just installed from CPAN on a fresh box and don’t have any issues…

    Kyle

    24 Jul 09 at 4:50 am

Leave a Reply