NAME

IMDB::Film - OO Perl interface to the movies database IMDB.

VERSION

IMDB::Film 0.01

SYNOPSIS

use IMDB;

my $imdbObj = new IMDB::Film(crit => 227445);

or

my $imdbObj = new IMDB::Film(crit => 'Troy');

print "Title: ".$imdbObj->title()."\n"; print "Year: ".$imdbObj->year()."\n"; print "Plot Symmary: ".$imdbObj->plot()."\n";

DESCRIPTION

Overview

IMDB::Film is an object-oriented interface to the IMDB. You can use that module to retrieve information about film: title, year, plot etc.

Constructor and initialization

new()

Object's constructor. You should pass as parameter movie title or IMDB code.

my $imdb = new IMDB::Film(crit => <some code>);

or

my $imdb = new IMDB::Film(crit => <some title>);

Also, you can specify following optional parameters:

- proxy - define proxy server name and port;
- debug	- switch on debug mode (on by default);
- cache - cache or not of content retrieved pages.
_init()

Initialize object.

Object Private Methods

_proxy()

Store address of proxy server. You can pass a proxy name as parameter into object constructor:

my $imdb = new IMDB::Film(code => 111111, proxy => 'my.proxy.host:8080');

or you can define environment variable 'http_host'. For exanple, for Linux you shoud do a following:

export http_proxy=my.proxy.host:8080
_cache()

Store cache flag. Indicate use file cache to store content page or not:

my $imdb = new IMDB::Film(code => 111111, cache => 1);
_cacheObj()

In case of using cache, we create new Cache::File object and store it in object's propery. For more details about Cache::File please see Cache::Cache documentation.

_cache_exp()

In case of using cache, we can define value time of cache expire.

my $imdb = new IMDB::Film(code => 111111, cache_exp => '1 h');

For more details please see Cache::Cache documentation.

_host()

Store IMDB host name. You can pass this value in object constructor:

my $imdb = new IMDB::Film(code => 111111, host => 'us.imdb.com');

By default, it uses 'www.imdb.com'.

_query()

Store query string to retrieve film by its ID. You can define different value for that:

my $imdb = new IMDB::Film(code => 111111, query => 'some significant string');

Default value is 'title/tt'.

_search()

Store search string to find film by its title. You can define different value for that:

C<my $imdb = new IMDB::Film(code => 111111, seach => 'some significant string');>

Default value is 'Find?select=Titles&for='.

_debug()

Indicate to use DEBUG mode to display some debug messages:

my $imdb = new IMDB::Film(code => 111111, debug => 1);

By default debug mode is switched off.

_content()

Connect to the IMDB, retrieve page according to crit: by film IMDB ID or its title and store content of that page in the object property. In case using cache, first check if page was already stored in the cache then retrieve page from the cache else store content of the page in the cache.

_parser()

Setup HTML::TokeParser and store. To have possibility to inherite that class we should every time initialize parser using stored content of page. For more information please see HTML::TokeParser documentation.

_search_film()

Implemets functionality to search film by name.

Object Public Methods

code()

Get IMDB film code.

C<my $code = $film->code();>
title()

Retrieve film title from film page. If was got search page instead of film page this method calls method _search_film to get list matched films and continue to process first one:

my $title = $film->title();
year()

Get film year:

my $year = $film->year();
cover()

Retrieve url of film cover:

my $cover = $film->cover();
directors()

Retrieve film directors list each element of which is hash reference - { id => <ID>, name => <Name> }:

my @directors = @{ $film->directors() };
writers()

Retrieve film writers list each element of which is hash reference - { id => <ID>, name => <Name> }:

my @writers = @{ $film->writers() };
genres()

Retrieve film genres list:

my @genres = @{ $film->genres() };
tagline()

Retrieve film tagline:

my $tagline = $film->tagline();
plot()

Retrieve film plot summary:

my $plot = $film->plot();
rating()

Retrieve film user rating:

my $rate = $film->rating();
casts()

Retrieve film casts list each element of which is hash reference - { id => <ID>, name => <Name> }:

my @casts = @{ $film->casts() };
duration()

Retrieve film duration in minutes:

my $duration = $film->duration();
country()

Retrieve film produced countries list:

my @countries = $film->country();
language()

Retrieve film languages list:

my @languages = $film->language();
summary()

Retrieve film user summary:

my $descr = $film->summary();
certifications()

Retrieve list of film certifications each element of which is hash reference - { country => certificate }:

my @cert = $film->certifications();
matched()

Retrieve list of matched films each element of which is hash reference - { id => <Film ID>, title => <Film Title>:

my @matched = @{ $film->matched() };
error()

Return string which contains error messages separated by \n:

my $errors = $film->error();

Class Variables

%FIELDS

Contains list all object's properties. See description of pragma fields.

@FILM_CERT

Matches USA film certification notation and age.

EXPORTS

Nothing

BUGS

Please, send me any found bugs by email: misha@thunderworx.com.

SEE ALSO

HTML::TokeParser, IMDB::Movie, perlobj

AUTHOR

Michael Stepanov (misha@thunderworx.com)

COPYRIGHT

Copyright (c) 2004, Michael Stepanov. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.