NAME

WWW::Moviepilot - Interface to the moviepilot.de database

VERSION

Version 0.04

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;
}

# 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.

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.

See WWW::Moviepilot::Movie.

person( $name )

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' );

search_person( $query )

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.

cast( $name )

Returns the cast of a movie.

my $m = WWW::Moviepilot->new(...);
my @cast = $m->cast('brust-oder-keule');

See WWW::Moviepilot::Person.

filmography( $name )

Returns the filmography of a person.

my $m = WWW::Moviepilot->new(...);
my @filmography = $m->filmography('paul-newman');

See WWW::Moviepilot::Movie.

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, WWW::Moviepilot::Person, 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:

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.