WWW::Moviepilot - Interface to the moviepilot.de database
Version 0.04
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; } # cast of a movie my @cast = $m->cast( 'matrix' ); foreach my $person ( @cast ) { print $person->last_name; print $person->character; } # filmography of a person my @filmography = $m->filmography( 'paul-newman' ); foreach my $movie ( @filmography ) { print $movie->display_title; print $movie->character; }
Please note: This module is still in early development and subject to change.
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
$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)
host
www.moviepilot.de
The host where the requests are sent to.
ua (default: LWP::UserAgent->new)
ua
LWP::UserAgent->new
A LWP::UserAgent compatible user agent.
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' );
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.
See WWW::Moviepilot::Movie.
Retrieve a person as WWW::Moviepilot::Person object. You should provide the name of the movie (this name is some kind of normalised, I'm not sure how exactly):
my $person = $m->person( 'paul-newman' );
Searches for a person and returns a list with results:
my @people = $m->search_person( 'Paul Newman' ); if ( @people == 0 ) { print 'no people found'; } else { # each $person is a WWW::Moviepilot::Person object foreach my $person ( @person ) { print $person->first_name; # e.g. Paul print $person->last_name; # e.g. Newman } }
See WWW::Moviepilot::Person.
Returns the cast of a movie.
my $m = WWW::Moviepilot->new(...); my @cast = $m->cast('brust-oder-keule');
Returns the filmography of a person.
my $m = WWW::Moviepilot->new(...); my @filmography = $m->filmography('paul-newman');
my $api_key = $m->api_key;
Returns the API key provided to the new constructor.
new
my $ua = $m->ua;
Returns the user agent, usually a LWP::UserAgent.
my $host = $m->host;
Returns host which the requests are sent to provided to the new constructor.
The Moviepilot API Dokumentation at http://wiki.github.com/moviepilot/moviepilot-API/, WWW::Moviepilot::Movie, WWW::Moviepilot::Person, LWP::UserAgent.
Frank Wiegand, <frank.wiegand at gmail.com>
<frank.wiegand at gmail.com>
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.
bug-www-moviepilot at rt.cpan.org
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
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Moviepilot
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Moviepilot
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Moviepilot
Search CPAN
http://search.cpan.org/dist/WWW-Moviepilot/
Thanks to the moviepilot.de team for providing an API key for developing and testing this module.
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.
To install WWW::Moviepilot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Moviepilot
CPAN shell
perl -MCPAN -e shell install WWW::Moviepilot
For more information on module installation, please visit the detailed CPAN module installation guide.