NAME
WWW::Moviepilot - Interface to the moviepilot.de database
VERSION
Version 0.01
SYNOPSIS
use WWW::Moviepilot;
my $m = WWW::Moviepilot->new({
api_key => ...,
host => 'www.moviepilot.de',
});
# direct retrieval
my $movie = $m->movie( 'matrix' );
# search
my @movies = $m->search_movie( 'matrix' );
foreach my $movie ( @movies ) {
print $movie->display_title;
}
METHODS
new( $args )
Creates a new WWW::Moviepilot instance.
my $m = WWW::Moviepilot->new( $args );
$args
must be a hash reference, you should supply an API key:
$args->{api_key} = ...;
To get a valid API key you should read http://wiki.github.com/moviepilot/moviepilot-API/.
Further optional arguments:
host
(default:www.moviepilot.de
)The host where the requests are sent to.
ua
(default:LWP::UserAgent->new
)A LWP::UserAgent compatible user agent.
movie( $name ) | movie( $source => $id )
Retrieve a movie as WWW::Moviepilot::Movie object. There are two ways to specify which movie to retrieve. First, you can provide the name of the movie (this name is some kind of normalised, I'm not sure how exactly):
my $movie = $m->movie( 'matrix' );
The second form is to provide an alternate ID:
my $movie = $m->movie( imdb => '133093' );
my $movie = $m->movie( amazon => 'B00004R80K' );
search_movie( $query )
Searches for a movie and returns a list with results:
my @movielist = $m->search_movie( 'matrix' );
if ( @movielist == 0 ) {
print 'no movies found';
}
else {
# each $movie is a WWW::Moviepilot::Movie object
foreach my $movie ( @movielist ) {
print $movie->display_title; # e.g. Matrix
print $movie->production_year; # e.g. 1999
print scalar $movie->emotions_list; # e.g. Spannend,Aufregend
# in list context, all *_list fields are split up by comma
my @emotions = $movie->emotions_list;
}
}
At most there are 20 movies returned.
api_key
my $api_key = $m->api_key;
Returns the API key provided to the new
constructor.
ua
my $ua = $m->ua;
Returns the user agent, usually a LWP::UserAgent.
host
my $host = $m->host;
Returns host which the requests are sent to provided to the new
constructor.
SEE ALSO
The Moviepilot API Dokumentation at http://wiki.github.com/moviepilot/moviepilot-API/, WWW::Moviepilot::Movie, LWP::UserAgent.
AUTHOR
Frank Wiegand, <frank.wiegand at gmail.com>
BUGS
Please report any bugs or feature requests to bug-www-moviepilot at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Moviepilot. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WWW::Moviepilot
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
Thanks to the moviepilot.de team for providing an API key for developing and testing this module.
COPYRIGHT & LICENSE
Copyright 2009 Frank Wiegand.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.