++ed by:

1 PAUSE user
1 non-PAUSE user.

Michael Stepanov


IMDB::BaseClass - a base class for IMDB::Film and IMDB::Persons.


  use base qw(IMDB::BaseClass);


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

Constructor and initialization


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

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


        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.

Initialize object. It gets list of service class properties and assign value to them from input parameters or from the hash with default values.


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


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


Get IMDB film code.

        my $code = $film->code();

Get IMDB film id (actually, it's the same as code).

        my $id = $film->id();

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

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

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

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.


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.


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


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

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='.


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.


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.


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.


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

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

Return string which contains error messages separated by \n:

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




Please, send me any found bugs by email: stepanov.michael@gmail.com.


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


Mikhail Stepanov (stepanov.michael@gmail.com)


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

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 411:

'=item' outside of any '=over'

Around line 474:

You forgot a '=back' before '=head1'