SYNOPSIS

  use base qw(IMDB::BaseClass);

DESCRIPTION

IMDB::BaseClass implements a base functionality for IMDB::Film and IMDB::Persons.

Constructor and initialization

new()

Object's constructor. You should pass as parameter movie title or \s-1IMDB\s0 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. It gets list of service class properties and assign value to them from input parameters or from the hash with default values.

user_agent()

Define an user agent for \s-1HTTP\s0 request. It's 'Mozilla/5.0' by default. For more information refer to LWP::UserAgent.

timeout()

Define a timeout for \s-1HTTP\s0 request in seconds. By default it's 10 sec. For more information refer to LWP::UserAgent.

code()

Get \s-1IMDB\s0 film code. my $code = $film->code();

id()

Get \s-1IMDB\s0 film id (actually, it's the same as code). my $id = $film->id();

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

_clear_cache

Store flag clear_cache which is indicated clear exisisting cache or not (false by default): my $imdb = new IMDB::Film(code => 111111, cache => 1, clear_cache => 1);

_cacheObj()

In case of using cache, we create new Cache::File object and store it in object's property. 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 \s-1IMDB\s0 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 \s-1ID\s0. You can define different value for that: my $imdb = new IMDB::Film(code => 111111, query => 'some significant string'); Default value is 'title/tt'. Note: this is a mainly service parameter. So, there is no reason to pass it in the real case.

_search()

Store search string to find film by its title. You can define different value for that: my $imdb = new IMDB::Film(code => 111111, seach => 'some significant string'); Default value is 'Find?select=Titles&for='.

_debug()

Indicate to use \s-1DEBUG\s0 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 \s-1IMDB\s0, retrieve page according to crit: by film \s-1IMDB\s0 \s-1ID\s0 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.

_get_simple_prop()

Retrieve a simple movie property which surrownded by <B>.

matched()

Retrieve list of matched films each element of which is hash reference - { id => <Film \s-1ID\s0>, title => <Film Title>: my @matched = @{ $film->matched() }; Note: if movie was matched by title unambiguously it won't be present in this array!

error()

Return string which contains error messages separated by \n: my $errors = $film->error();

EXPORTS

Nothing

BUGS

Please, send me any found bugs by email: [email protected].

RELATED TO IMDB::BaseClass…

IMDB::Persons IMDB::Film WWW::Yahoo::Movies HTML::TokeParser

AUTHOR

Mikhail Stepanov \s-1AKA\s0 nite_man ([email protected])

COPYRIGHT

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