.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "IMDB::BaseClass 3pm" .TH IMDB::BaseClass 3pm "2013-01-04" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" IMDB::BaseClass \- a base class for IMDB::Film and IMDB::Persons. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use base qw(IMDB::BaseClass); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" IMDB::BaseClass implements a base functionality for IMDB::Film and IMDB::Persons. .SS "Constructor and initialization" .IX Subsection "Constructor and initialization" .IP "\fInew()\fR" 4 .IX Item "new()" Object's constructor. You should pass as parameter movie title or \s-1IMDB\s0 code. .Sp .Vb 1 \& my $imdb = new IMDB::Film(crit => ); .Ve .Sp or .Sp .Vb 1 \& my $imdb = new IMDB::Film(crit => ); .Ve .Sp Also, you can specify following optional parameters: .Sp .Vb 3 \& \- proxy \- define proxy server name and port; \& \- debug \- switch on debug mode (on by default); \& \- cache \- cache or not of content retrieved pages. .Ve .IP "\fI_init()\fR" 4 .IX Item "_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. .IP "\fIuser_agent()\fR" 4 .IX Item "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. .IP "\fItimeout()\fR" 4 .IX Item "timeout()" Define a timeout for \s-1HTTP\s0 request in seconds. By default it's 10 sec. For more information refer to LWP::UserAgent. .IP "\fIcode()\fR" 4 .IX Item "code()" Get \s-1IMDB\s0 film code. .Sp .Vb 1 \& my $code = $film\->code(); .Ve .IP "\fIid()\fR" 4 .IX Item "id()" Get \s-1IMDB\s0 film id (actually, it's the same as code). .Sp .Vb 1 \& my $id = $film\->id(); .Ve .IP "\fI_proxy()\fR" 4 .IX Item "_proxy()" Store address of proxy server. You can pass a proxy name as parameter into object constructor: .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, proxy => \*(Aqmy.proxy.host:8080\*(Aq); .Ve .Sp or you can define environment variable 'http_host'. For exanple, for Linux you shoud do a following: .Sp .Vb 1 \& export http_proxy=my.proxy.host:8080 .Ve .IP "\fI_cache()\fR" 4 .IX Item "_cache()" Store cache flag. Indicate use file cache to store content page or not: .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, cache => 1); .Ve .IP "_clear_cache" 4 .IX Item "_clear_cache" Store flag clear_cache which is indicated clear exisisting cache or not (false by default): .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, cache => 1, clear_cache => 1); .Ve .IP "\fI_cacheObj()\fR" 4 .IX Item "_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. .IP "\fI_cache_exp()\fR" 4 .IX Item "_cache_exp()" In case of using cache, we can define value time of cache expire. .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, cache_exp => \*(Aq1 h\*(Aq); .Ve .Sp For more details please see Cache::Cache documentation. .IP "\fI_host()\fR" 4 .IX Item "_host()" Store \s-1IMDB\s0 host name. You can pass this value in object constructor: .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, host => \*(Aqus.imdb.com\*(Aq); .Ve .Sp By default, it uses 'www.imdb.com'. .IP "\fI_query()\fR" 4 .IX Item "_query()" Store query string to retrieve film by its \s-1ID\s0. You can define different value for that: .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, query => \*(Aqsome significant string\*(Aq); .Ve .Sp Default value is 'title/tt'. .Sp \&\fBNote: this is a mainly service parameter. So, there is no reason to pass it in the real case.\fR .IP "\fI_search()\fR" 4 .IX Item "_search()" Store search string to find film by its title. You can define different value for that: .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, seach => \*(Aqsome significant string\*(Aq); .Ve .Sp Default value is 'Find?select=Titles&for='. .IP "\fI_debug()\fR" 4 .IX Item "_debug()" Indicate to use \s-1DEBUG\s0 mode to display some debug messages: .Sp .Vb 1 \& my $imdb = new IMDB::Film(code => 111111, debug => 1); .Ve .Sp By default debug mode is switched off. .IP "\fI_content()\fR" 4 .IX Item "_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. .IP "\fI_parser()\fR" 4 .IX Item "_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. .IP "\fI_get_simple_prop()\fR" 4 .IX Item "_get_simple_prop()" Retrieve a simple movie property which surrownded by . .IP "\fImatched()\fR" 4 .IX Item "matched()" Retrieve list of matched films each element of which is hash reference \- { id => , title => : .Sp .Vb 1 \& my @matched = @{ $film\->matched() }; .Ve .Sp Note: if movie was matched by title unambiguously it won't be present in this array! .IP "\fIerror()\fR" 4 .IX Item "error()" Return string which contains error messages separated by \en: .Sp .Vb 1 \& my $errors = $film\->error(); .Ve .SH "EXPORTS" .IX Header "EXPORTS" Nothing .SH "BUGS" .IX Header "BUGS" Please, send me any found bugs by email: stepanov.michael@gmail.com. .SH "SEE ALSO" .IX Header "SEE ALSO" IMDB::Persons IMDB::Film WWW::Yahoo::Movies HTML::TokeParser .SH "AUTHOR" .IX Header "AUTHOR" Mikhail Stepanov \s-1AKA\s0 nite_man (stepanov.michael@gmail.com) .SH "COPYRIGHT" .IX Header "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.