IMDB::BaseClass(3)

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

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 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. 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 HTTP request. It's 'Mozilla/5.0' by default. For more information refer to LWP::UserAgent.

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

code()
    Get IMDB film code.

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

id()
    Get IMDB 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 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'.

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

_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 ID>, 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: stepanov.michael@gmail.com.

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

AUTHOR
Mikhail Stepanov AKA nite_man (stepanov.michael@gmail.com)

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.