| 1 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | IMDB::Film - OO Perl interface to the movies database IMDB. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | use IMDB::Film; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Retrieve a movie information by its IMDB code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | my $imdbObj = new IMDB::Film(crit => 227445); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Retrieve a movie information by its title | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | my $imdbObj = new IMDB::Film(crit => 'Troy'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Parse already stored HTML page from IMDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | my $imdbObj = new IMDB::Film(crit => 'troy.html'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | if($imdbObj->status) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | print "Title: ".$imdbObj->title()."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | print "Year: ".$imdbObj->year()."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | print "Plot Symmary: ".$imdbObj->plot()."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | print "Something wrong: ".$imdbObj->error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | =head2 Overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | IMDB::Film is an object-oriented interface to the IMDB. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | You can use that module to retrieve information about film: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | title, year, plot etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | package IMDB::Film; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | use base qw(IMDB::BaseClass); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | use fields qw( _title | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | _kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | _year | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | _episodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | _episodeof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | _summary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | _cast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | _directors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | _writers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | _cover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | _language | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | _country | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | _top_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | _rating | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | _genres | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | _tagline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | _plot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | _also_known_as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | _certifications | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | _duration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | _full_plot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | _trivia | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | _goofs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | _awards | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | _official_sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | _release_dates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | _aspect_ratio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | _mpaa_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | _company | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | _connections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | _full_companies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | _recommendation_movies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | _plot_keywords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | _big_cover_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | _big_cover_page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | _storyline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | full_plot_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | use vars qw( $VERSION %FIELDS %FILM_CERT %FILM_KIND $PLOT_URL ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | ▶ | use constant CLASS_NAME => 'IMDB::Film'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | ▶ | use constant FORCED => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | ▶ | use constant USE_CACHE => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | use constant DEBUG_MOD => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | ▶ | use constant EMPTY_OBJECT => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | ▶ | use constant MAIN_TAG => 'h4'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | $VERSION = '0.53'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # Convert age gradation to the digits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # TODO: Store this info into constant file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | %FILM_CERT = ( G => 'All', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | R => 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 'NC-17' => 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | PG => 13, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 'PG-13' => 13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | %FILM_KIND = ( '' => 'movie', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | TV => 'tv movie', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | V => 'video movie', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | mini => 'tv mini series', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | VG => 'video game', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | S => 'tv series', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | E => 'episode' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1 | my %_defaults = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | cache => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | debug => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | error => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | cache_exp => '1 h', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | cache_root => '/tmp', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | matched => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | host => 'www.imdb.com', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | query => 'title/tt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | search => 'find?s=tt&exact=true&q=', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | status => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | timeout => 10, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | user_agent => 'Mozilla/5.0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | decode_html => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | full_plot_url => 'http://www.imdb.com/rg/title-tease/plotsummary/title/tt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | _also_known_as => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | _official_sites => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | _release_dates => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | _duration => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | _top_info => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | _cast => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub _get_default_attrs { keys %_defaults } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_default_attrs: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub _get_default_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_default_value: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my($self, $attr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $_defaults{$attr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | =head2 Constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | =item new() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | Object's constructor. You should pass as parameter movie title or IMDB code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | my $imdb = new IMDB::Film(crit => <some code>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | my $imdb = new IMDB::Film(crit => <some title>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | my $imdb = new IMDB::Film(crit => <HTML file>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | For more infomation about base methods refer to IMDB::BaseClass. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | =item _init() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | Initialize object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | sub _init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=6 SCAR=36.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | croak "Film IMDB ID or Title should be defined!" if !$args{crit} && !$args{file}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"crit"} or $args{"file"}
MC/DC0%0/2
$args{"crit"} or $args{"file"}
$args{"crit"}
$args{"file"}
Truth table0%0/3
A or B
A= $args{"crit"}B= $args{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->SUPER::_init(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $self->title(FORCED, \%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | unless($self->title) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->status(EMPTY_OBJECT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->error('Not Found'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | for my $prop (grep { /^_/ && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
/^_/ && !/^(_title|_code|_full_plot|_official_sites|_release_dates|_connections|_full_companies|_plot_keywords|_big_cover_url|_big_cover_page)$/
MC/DC0%0/2
/^_/ && !/^(_title|_code|_full_plot|_official_sites|_release_dates|_connections|_full_companies|_plot_keywords|_big_cover_url|_big_cover_page)$/
/^_/
!/^(_title|_code|_full_plot|_official_sites|_release_dates|_connections|_full_companies|_plot_keywords|_big_cover_url|_big_cover_page)$/
Truth table0%0/3
A && not(B)
A= /^_/B= !/^(_title|_code|_full_plot|_official_sites|_release_dates|_connections|_full_companies|_plot_keywords|_big_cover_url|_big_cover_page)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | !/^(_title|_code|_full_plot|_official_sites|_release_dates|_connections|_full_companies|_plot_keywords|_big_cover_url|_big_cover_page)$/ } sort keys %FIELDS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ($prop) = $prop =~ /^_(.*)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $self->$prop(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | =head2 Options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | =item year | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | Define a movie's year. It's useful to use it to get the proper movie by its title: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | my $imdbObj = new IMDB::Film(crit => 'Jack', year => 2003); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | print "Got #" . $imdbObj->code . " " . $imdbObj->title . "\n"; #0379836 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | =item proxy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | defines proxy server name and port: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | proxy => 'http://proxy.myhost.com:80' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | By default object tries to get proxy from environment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | =item debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | switches on debug mode to display useful debug messages. Can be 0 or 1 (0 by default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | =item cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | indicates use cache or not to store retrieved page content. Can be 0 or 1 (0 by default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | =item cache_root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | specifies a directory to store cache data. By default it use /tmp/FileCache for *NIX OS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | =item cache_exp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | specifies an expiration time for cache. By default, it's 1 hour | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | =item clear_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | indicates clear cached data before get request to IMDB.com or not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | =item timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | specifies a timeout for HTTP connection in seconds (10 sec by default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | =item user_agent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | specifies an user agent for request ('Mozilla/5.0' by default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | =item full_plot_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | specifies a full plot url for specified movie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | =item host | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | specifies a host name for IMDB site. By default it's www.imdb.com | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | =item query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | specifies a query string to get specified movie by its ID. By defualt it's 'title/tt' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | =item search | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | specifies query string to make a search movie by its title. By default it's 'find?tt=on;mx=20;q=' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | my $imdb = new IMDB::Film( crit => 'Troy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | user_agent => 'Opera/8.x', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | timeout => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | debug => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | cache => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | cache_root => '/tmp/imdb_cache', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | cache_exp => '1 d', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | It'll create an object with critery 'Troy', user agent 'Opera', timeout 2 seconds, debug mode on, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | using cache with directory '/tmp/imdb_cache' and expiration time in 1 day. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub full_plot_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
full_plot_url: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if(@_) { $self->{full_plot_url} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | return $self->{full_plot_url} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub fields { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fields: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | return \%FIELDS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | =head2 Object Private Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | =item _search_film() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | Implemets functionality to search film by name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub _search_film { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_search_film: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | my $args = shift || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | return $self->SUPER::_search_results('^\/title\/tt(\d+)', '/td', $args->{year}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | =head2 Object Public Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | =item status() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | Indicates a status of IMDB object: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 - empty object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 1 - loaded from file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 2 - loaded from internet request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 3 - loaded from cache. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | =item status_descr() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | Return a description for IMDB object status. Can be 'Empty', 'Filed', 'Fresh' and 'Cached': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | if($film->status) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | print "This is a " . $film->status_descr . " object!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | die "Cannot retrieve IMDB object!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | =item title() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | Retrieve film title from film page. If was got search page instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | of film page this method calls method _search_film to get list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | matched films and continue to process first one: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | my $title = $film->title(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | sub title { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
title: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | my $args = shift || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $parser->get_tag('title'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my $title = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | if($title =~ /Find \- IMDb/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->_show_message("Go to search page ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $title = $self->_search_film($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if($title) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | $self->retrieve_code($parser, 'http://www.imdb.com/title/tt(\d+)') unless $self->code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $title =~ s/\*/\\*/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $title = $self->_decode_special_symbols($title); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $self->_show_message("title: $title", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # TODO: implement parsing of TV series like ALF (TV Series 1986–1990) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $title =~ s/^imdb\s+\-\s+//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ($self->{_title}, $self->{_year}, $self->{_kind}) = $title =~ m!(.*?)\s+\((\d{4})(?:/[IVX]+)\)(?:\s\((\w*)\))?!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | unless($self->{_title}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ($self->{_title}, $self->{_kind}, $self->{_year}) = $title =~ m!(.*?)\s+\((.*?)?\s?([0-9\-]*\s?)\)!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | $self->{_kind} = 'Movie' unless $self->{_kind}; # Default kind should be movie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | # "The Series" An Episode (2005) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # "The Series" (2005) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | if( $self->{_title} =~ /\"[^\"]+\"(\s+.+\s+)?/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | $self->{_kind} = $1 ? 'E' : 'S'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | return $self->{_title}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | =item kind() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | Get kind of movie: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | my $kind = $film->kind(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | Possible values are: 'movie', 'tv series', 'tv mini series', 'video game', 'video movie', 'tv movie', 'episode'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | sub kind { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
kind: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | return exists $FILM_KIND{$self->{_kind}} ? $FILM_KIND{$self->{_kind}} : lc($self->{_kind}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | =item year() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | Get film year: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | my $year = $film->year(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | sub year { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
year: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | return $self->{_year}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | =item connections() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | Retrieve connections for the movie as an arrays of hashes with folloeing structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | follows => [ { id => <id>, title => <name>, year => <year>, ..., } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | followed_by => [ { id => <id>, title => <name>, year => <year>, ..., } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | references => [ { id => <id>, title => <name>, year => <year>, ..., } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | referenced_in => [ { id => <id>, title => <name>, year => <year>, ..., } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | featured_in => [ { id => <id>, title => <name>, year => <year>, ..., } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | spoofed_by => [ { id => <id>, title => <name>, year => <year>, ..., } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | my %connections = %{ $film->connections() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | sub connections { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connections: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | unless($self->{_connections}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $page = $self->_cacheObj->get($self->code . '_connections') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/trivia?tab=mc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $self->_show_message("URL for movie connections is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | $self->_cacheObj->set($self->code.'_connections', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | my $group = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my %result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | my @lookFor = ('h4'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | while (my $tag = $parser->get_tag(@lookFor)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | if ($tag->[0] eq 'h4') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | $group = HTML::Entities::encode_entities($parser->get_text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $group = lc($group); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $group =~ s/\s+/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $group =~ s/( |\?|\:)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $group =~ s/&/and/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | $result{$group} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | @lookFor = ('h4', 'a', 'hr', 'hr/'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } elsif ($tag->[0] eq 'a') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | ($id)= $tag->[1]->{href} =~ /(\d+)/ if $tag->[1]->{href}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | my $name = $parser->get_trimmed_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # Handle series episodes (usually in 'referenced' sections) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my($series,$t,$s,$e) = ($name =~ /^(.*?): *(.*?) *\(?#(\d+)\.(\d+)\)?$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | $name = $series if defined $series; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $tag = $parser->get_tag('/a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | my $next = $parser->get_trimmed_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my %film = ('id' => $id, 'title' => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | if(defined $t) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | $film{'series_title'} = $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | $film{'season'} = $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | $film{'episode'} = $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | $film{'year'} = $1 if $next =~ /\((\d{4})\)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | next if ($next =~ /\(VG\)/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | push @{$result{$group}}, \%film; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # Stop when we hit the divider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $self->{_connections} = \%result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | return $self->{_connections}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | =item full_companies() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | Retrieve companies for the movie as an array where each item has following stucture: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | production => [ { name => <company name>, url => <imdb url>, extra => <specific task> } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | distributors => [ { name => <company name>, url => <imdb url>, extra => <specific task> } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | special_effects => [ { name => <company name>, url => <imdb url>, extra => <specific task> } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | other => [ { name => <company name>, url => <imdb url>, extra => <specific task> } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | my %full_companies = %{ $film->full_companies() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | sub full_companies { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
full_companies: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | unless($self->{_full_companies}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | $page = $self->_cacheObj->get($self->code . '_full_companies') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/companycredits"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $self->_show_message("URL for company credits is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | $self->_cacheObj->set($self->code.'_full_companies', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | my $group = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my %result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my @lookFor = ('h2'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | while (my $tag = $parser->get_tag(@lookFor)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | if ($tag->[0] eq 'h2') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | $group = $parser->get_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $group =~ s/ compan(y|ies)//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $group =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $group =~ s/\s+/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | $result{$group} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | @lookFor = ('h2', 'a', 'hr', 'hr/'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } elsif($tag->[0] eq 'a') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | my($url) = $tag->[1]->{href}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $name = $parser->get_trimmed_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $tag = $parser->get_tag('/a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | my $next = $parser->get_trimmed_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $next =~ s/^[\t \xA0]+//; # nbsp comes out as \xA0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my %company = ( 'url' => $url, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 'name' => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 'extra' => $next ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | push @{$result{$group}}, \%company; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | # Stop when we hit the divider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $self->{_full_companies} = \%result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | return $self->{_full_companies}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | =item company() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | Returns a list of companies given for a specified movie: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | my $company = $film->company(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | my @companies = $film->company(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | sub company { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
company: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | unless($self->{_company}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | my @companies = split /\s?\,\s?/, $self->_get_simple_prop('Production Co'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $self->{_company} = \@companies; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | return wantarray ? $self->{_company} : $self->{_company}[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | =item episodes() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | Retrieve episodes info list each element of which is hash reference for tv series - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | { id => <ID>, title => <Title>, season => <Season>, episode => <Episode>, date => <Date>, plot => <Plot> }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | my @episodes = @{ $film->episodes() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | sub episodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
episodes: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | return [] if !$self->kind or $self->kind !~ /tv serie/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->kind and $self->kind =~ /tv serie/i
MC/DC0%0/2
$self->kind and $self->kind =~ /tv serie/i
$self->kind
$self->kind =~ /tv serie/i
Truth table0%0/3
A and B
A= $self->kindB= $self->kind =~ /tv serie/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | unless($self->{_episodes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | $page = $self->_cacheObj->get($self->code . '_episodes') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/epcast"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $self->_show_message("URL for episodes is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | $self->_cacheObj->set($self->code.'_episodes', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | while(my $tag = $parser->get_tag('h4')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | my $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | my($season, $episode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | next unless(($season, $episode) = $parser->get_text =~ /Season\s+(.*?),\s+Episode\s+([^:]+)/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | my $imdb_tag = $parser->get_tag('a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | ($id) = $imdb_tag->[1]->{href} =~ /(\d+)/ if $imdb_tag->[1]->{href}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | my $title = $parser->get_trimmed_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | $parser->get_tag('b'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my($date) = $parser->get_trimmed_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | $parser->get_tag('br'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | my $plot = $parser->get_trimmed_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | push @{ $self->{_episodes} }, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | season => $season, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | episode => $episode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | title => $title, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | date => $date, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | plot => $plot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | return $self->{_episodes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | =item episodeof() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | Retrieve parent tv series list each element of which is hash reference for episode - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | { id => <ID>, title => <Title>, year => <Year> }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | my @tvseries = @{ $film->episodeof() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | sub episodeof { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
episodeof: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | return if !$self->kind or $self->kind ne "episode"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->kind or $self->kind ne "episode"
MC/DC0%0/2
not $self->kind or $self->kind ne "episode"
not $self->kind
$self->kind ne "episode"
Truth table0%0/3
not(A) or B
A= not $self->kindB= $self->kind ne "episode"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | my($episodeof, $title, $year, $episode, $season, $id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | my($parser) = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | while($parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | ▶ | last if $parser->get_text =~ /^TV Series/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | while(my $tag = $parser->get_tag('a')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | ▶ | ($title, $year) = ($1, $2) if $parser->get_text =~ m!(.*?)\s+\(([\d\?]{4}).*?\)!; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | last unless $tag->[1]{href} =~ /title/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ($id) = $tag->[1]{href} =~ /(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | #start again | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | while($parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | last if $parser->get_text =~ /^Original Air Date/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $parser->get_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ($season, $episode) = $parser->get_text =~ /\(Season\s+(\d+),\s+Episode\s+(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | push @{ $self->{_episodeof} }, {title => $title, year => $year, id => $id, season => $season, episode => $episode}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | return $self->{_episodeof}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | =item cover() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | Retrieve url of film cover: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | my $cover = $film->cover(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | sub cover { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cover: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | my $cover; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my $title = quotemeta($self->title); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | while(my $img_tag = $parser->get_tag('img')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | $img_tag->[1]{alt} ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$img_tag->[1]{"alt"} ||= ""
MC/DC0%0/1
$img_tag->[1]{"alt"} ||= ""
$img_tag->[1]{"alt"}
Truth table0%0/2
A
A= $img_tag->[1]{"alt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | last if $img_tag->[1]{alt} =~ /^poster not submitted/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | if($img_tag->[1]{alt} =~ /Poster$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | $cover = $img_tag->[1]{src}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | $self->{_cover} = $cover; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | return $self->{_cover}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | sub top_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
top_info: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | ▶ | if($forced or !$self->{'_top_info'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$forced or not $self->{"_top_info"}
MC/DC0%0/2
$forced or not $self->{"_top_info"}
$forced
not $self->{"_top_info"}
Truth table0%0/3
A or not(B)
A= $forcedB= not $self->{"_top_info"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | ▶ | while(my $tag = $parser->get_tag('div')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | ▶ | last if $tag->[1]->{class} && $tag->[1]->{class} eq 'article highlighted'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"class"} and $tag->[1]{"class"} eq "article highlighted"
MC/DC0%0/2
$tag->[1]{"class"} and $tag->[1]{"class"} eq "article highlighted"
$tag->[1]{"class"}
$tag->[1]{"class"} eq "article highlighted"
Truth table0%0/3
A and B
A= $tag->[1]{"class"}B= $tag->[1]{"class"} eq "article highlighted"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | my $text = $parser->get_trimmed_text('span'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | my @top_items = split /\s?\|\s?/, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $self->{_top_info} = \@top_items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | return $self->{_top_info}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | =item recommendation_movies() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | Return a list of recommended movies for specified one as a hash where each key is a movie ID in IMDB and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | value - movie's title: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | $recommendation_movies = $film->recommendation_movies(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | For example, the list of recommended movies for Troy will be similar to that: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | $VAR1 = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | '0416449' => '300', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | '0167260' => 'The Lord of the Rings: The Return of the King', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | '0442933' => 'Beowulf', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | '0320661' => 'Kingdom of Heaven', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | '0172495' => 'Gladiator' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | ▶ | sub recommendation_movies { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recommendation_movies: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | ▶ | while(my $tag = $parser->get_tag('h2')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | last if $text =~ /recommendations/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my %result = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | ▶ | while(my $tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | ▶ | last if $tag->[0] eq '/table'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | if($tag->[0] eq 'a' && $text && $tag->[1]{href} =~ /tt(\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "a" and $text and $tag->[1]{"href"} =~ /tt(\d+)/
$tag->[0] eq "a" and $text
MC/DC0%0/3
$tag->[0] eq "a" and $text and $tag->[1]{"href"} =~ /tt(\d+)/
$tag->[0] eq "a"
$text
$tag->[1]{"href"} =~ /tt(\d+)/
Truth table0%0/4
A and B and C
A= $tag->[0] eq "a"B= $textC= $tag->[1]{"href"} =~ /tt(\d+)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | $result{$1} = $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | $self->{_recommendation_movies} = \%result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | return $self->{_recommendation_movies}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | =item directors() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | Retrieve film directors list each element of which is hash reference - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | { id => <ID>, name => <Name> }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | my @directors = @{ $film->directors() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | ▶ | sub directors { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
directors: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my ($parser) = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | my (@directors, $tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | ▶ | while($tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | my $text = $parser->get_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | last if $text =~ /direct(?:ed|or)/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | while ($tag = $parser->get_tag() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | last if $text =~ /^writ(?:ing|ers)/i or $tag->[0] eq '/div'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$text =~ /^writ(?:ing|ers)/i or $tag->[0] eq "/div"
MC/DC0%0/2
$text =~ /^writ(?:ing|ers)/i or $tag->[0] eq "/div"
$text =~ /^writ(?:ing|ers)/i
$tag->[0] eq "/div"
Truth table0%0/3
A or B
A= $text =~ /^writ(?:ing|ers)/iB= $tag->[0] eq "/div"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | if($tag->[0] eq 'a' && $tag->[1]{href} && $text !~ /(img|more)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "a" and $tag->[1]{"href"} and not $text =~ /(img|more)/i
$tag->[0] eq "a" and $tag->[1]{"href"}
MC/DC0%0/3
$tag->[0] eq "a" and $tag->[1]{"href"} and not $text =~ /(img|more)/i
$tag->[0] eq "a"
$tag->[1]{"href"}
not $text =~ /(img|more)/i
Truth table0%0/4
A and B and not(C)
A= $tag->[0] eq "a"B= $tag->[1]{"href"}C= not $text =~ /(img|more)/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | my($id) = $tag->[1]{href} =~ /(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | push @directors, {id => $id, name => $text}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | $self->{_directors} = \@directors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | return $self->{_directors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | =item writers() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | Retrieve film writers list each element of which is hash reference - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | { id => <ID>, name => <Name> }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | my @writers = @{ $film->writers() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | <I>Note: this method returns Writing credits from movie main page. It maybe not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | contain a full list!</I> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | ▶ | sub writers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
writers: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | my ($parser) = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | my (@writers, $tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | while($tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | ▶ | last if $parser->get_text =~ /writ(?:ing|ers|er)/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | while($tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | last if $tag->[0] eq '/div'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | ▶ | if($tag->[0] eq 'a' && $tag->[1]{href} && $text !~ /more/i && $text !~ /img/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$tag->[0] eq "a" and $tag->[1]{"href"} and not $text =~ /more/i and not $text =~ /img/i
$tag->[0] eq "a" and $tag->[1]{"href"} and not $text =~ /more/i
$tag->[0] eq "a" and $tag->[1]{"href"}
MC/DC0%0/4
$tag->[0] eq "a" and $tag->[1]{"href"} and not $text =~ /more/i and not $text =~ /img/i
$tag->[0] eq "a"
$tag->[1]{"href"}
not $text =~ /more/i
not $text =~ /img/i
Truth table0%0/5
A and B and not(C) and not(D)
A= $tag->[0] eq "a"B= $tag->[1]{"href"}C= not $text =~ /more/iD= not $text =~ /img/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | ▶ | if(my($id) = $tag->[1]{href} =~ /nm(\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | push @writers, {id => $id, name => $text}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | $self->{_writers} = \@writers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | return $self->{_writers}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | =item genres() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | Retrieve film genres list: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | my @genres = @{ $film->genres() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | sub genres { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
genres: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | my ($parser) = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | my (@genres); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | while(my $tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | last if $parser->get_text =~ /^genre/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | ▶ | while(my $tag = $parser->get_tag('a')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | my $genre = $parser->get_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | last unless $tag->[1]{href} =~ m!/genre/!i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | ▶ | last if $genre =~ /more/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | push @genres, $genre; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | $self->{_genres} = \@genres; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | return $self->{_genres}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | =item tagline() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | Retrieve film tagline: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | my $tagline = $film->tagline(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | sub tagline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tagline: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | my ($parser) = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | while(my $tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | last if($parser->get_text =~ /tagline/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | $self->{_tagline} = $parser->get_trimmed_text(MAIN_TAG, 'a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | return $self->{_tagline}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | =item plot() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | Returns a movie plot: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | my $plot = $film->plot; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | sub plot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plot: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | return $self->{_plot}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | =item storyline() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | Retrieve film plot summary: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | my $storyline = $film->storyline(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | sub storyline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
storyline: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | ▶ | while(my $tag = $parser->get_tag('h2')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | last if $parser->get_text =~ /^storyline$/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | my $plot = $parser->get_trimmed_text(MAIN_TAG, 'em'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | $self->{_storyline} = $self->_decode_special_symbols($plot); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | return $self->{_storyline}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | =item rating() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | In scalar context returns film user rating, in array context returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | film rating, number of votes and info about place in TOP 250 or some other TOP and avards: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | my $rating = $film->rating(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | my($rating, $vnum, $avards) = $film->rating(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | print "RATING: $rating ($vnum votes)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | Note, that $avards is array reference where the first elemen is a TOP info if so, and the next element is other avards - Oscar, nominations and etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | ▶ | sub rating { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rating: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | my ($forced) = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | ▶ | while(my $tag = $parser->get_tag('div')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | last if $tag->[1]{class} && $tag->[1]{class} eq 'star-box-details'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"class"} and $tag->[1]{"class"} eq "star-box-details"
MC/DC0%0/2
$tag->[1]{"class"} and $tag->[1]{"class"} eq "star-box-details"
$tag->[1]{"class"}
$tag->[1]{"class"} eq "star-box-details"
Truth table0%0/3
A and B
A= $tag->[1]{"class"}B= $tag->[1]{"class"} eq "star-box-details"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | my $text = $parser->get_trimmed_text('/a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | my($rating, $val) = $text =~ m!(\d+\.?\d*)/10.*?(\d+,?\d*)!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | ▶ | $val =~ s/\,// if $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | $self->{_rating} = [$rating, $val, $self->top_info]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | ▶ | unless($self->{_plot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | my $tag = $parser->get_tag('p'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | my $text = $parser->get_trimmed_text('/p'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | $self->{_plot} = $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | ▶ | return wantarray ? @{ $self->{_rating} } : $self->{_rating}[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | =item cast() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | Retrieve film cast list each element of which is hash reference - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | { id => <ID>, name => <Full Name>, role => <Role> }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | my @cast = @{ $film->cast() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | <I> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | Note: this method retrieves a cast list first billed only! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | </I> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | ▶ | sub cast { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cast: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | ▶ | my ($forced) = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | my (@cast, $tag, $person, $id, $role); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | while($tag = $parser->get_tag('table')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | ▶ | last if $tag->[1]->{class} && $tag->[1]->{class} =~ /^cast_list$/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"class"} and $tag->[1]{"class"} =~ /^cast_list$/i
MC/DC0%0/2
$tag->[1]{"class"} and $tag->[1]{"class"} =~ /^cast_list$/i
$tag->[1]{"class"}
$tag->[1]{"class"} =~ /^cast_list$/i
Truth table0%0/3
A and B
A= $tag->[1]{"class"}B= $tag->[1]{"class"} =~ /^cast_list$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | ▶ | while($tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | ▶ | last if $tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ /fullcredits/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ /fullcredits/i
$tag->[0] eq "a" and $tag->[1]{"href"}
MC/DC0%0/3
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ /fullcredits/i
$tag->[0] eq "a"
$tag->[1]{"href"}
$tag->[1]{"href"} =~ /fullcredits/i
Truth table0%0/4
A and B and C
A= $tag->[0] eq "a"B= $tag->[1]{"href"}C= $tag->[1]{"href"} =~ /fullcredits/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | ▶ | if($tag->[0] eq 'td' && $tag->[1]{class} && $tag->[1]{class} eq 'name') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "td" and $tag->[1]{"class"} and $tag->[1]{"class"} eq "name"
$tag->[0] eq "td" and $tag->[1]{"class"}
MC/DC0%0/3
$tag->[0] eq "td" and $tag->[1]{"class"} and $tag->[1]{"class"} eq "name"
$tag->[0] eq "td"
$tag->[1]{"class"}
$tag->[1]{"class"} eq "name"
Truth table0%0/4
A and B and C
A= $tag->[0] eq "td"B= $tag->[1]{"class"}C= $tag->[1]{"class"} eq "name"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | $tag = $parser->get_tag('a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | ▶ | if($tag->[1]{href} && $tag->[1]{href} =~ m#name/nm(\d+?)/#) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"href"} and $tag->[1]{"href"} =~ m[name/nm(\d+?)/]
MC/DC0%0/2
$tag->[1]{"href"} and $tag->[1]{"href"} =~ m[name/nm(\d+?)/]
$tag->[1]{"href"}
$tag->[1]{"href"} =~ m[name/nm(\d+?)/]
Truth table0%0/3
A and B
A= $tag->[1]{"href"}B= $tag->[1]{"href"} =~ m[name/nm(\d+?)/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | $person = $parser->get_text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | $id = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | my $text = $parser->get_trimmed_text('/tr'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | ($role) = $text =~ /.*?\s+(.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | push @cast, {id => $id, name => $person, role => $role}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | $self->{_cast} = \@cast; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | return $self->{_cast}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | =item duration() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | In the scalar context it retrieves a film duration in minutes (the first record): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | my $duration = $film->duration(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | In array context it retrieves all movie's durations: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | my @durations = $film->duration(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | ▶ | sub duration { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
duration: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | ▶ | while(my $tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | last if $text =~ /runtime:/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | my $duration_str = $self->_decode_special_symbols($parser->get_trimmed_text(MAIN_TAG, '/div')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | my @runtime = split /\s+(\/|\|)\s+/, $duration_str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | $self->{_duration} = \@runtime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | ▶ | return wantarray ? @{ $self->{_duration} } : $self->{_duration}->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | =item country() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | Retrieve film produced countries list: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | my $countries = $film->country(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | sub country { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
country: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | while (my $tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | ▶ | last if $parser->get_text =~ /country/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | my (@countries); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | while(my $tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | ▶ | if( $tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ m!/country/[a-z]{2}!i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ m[/country/[a-z]{2}]i
$tag->[0] eq "a" and $tag->[1]{"href"}
MC/DC0%0/3
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ m[/country/[a-z]{2}]i
$tag->[0] eq "a"
$tag->[1]{"href"}
$tag->[1]{"href"} =~ m[/country/[a-z]{2}]i
Truth table0%0/4
A and B and C
A= $tag->[0] eq "a"B= $tag->[1]{"href"}C= $tag->[1]{"href"} =~ m[/country/[a-z]{2}]i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | $text =~ s/\n//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | push @countries, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | last if $tag->[0] eq 'br'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | $self->{_country} = \@countries; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | return $self->{_country} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | =item language() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | Retrieve film languages list: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | my $languages = $film->language(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | ▶ | sub language { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
language: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | my (@languages, $tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | while ($tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | ▶ | last if $parser->get_text =~ /language/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | ▶ | while($tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 0 | ▶ | if( $tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ m!/language/[a-z]{2}!i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ m[/language/[a-z]{2}]i
$tag->[0] eq "a" and $tag->[1]{"href"}
MC/DC0%0/3
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ m[/language/[a-z]{2}]i
$tag->[0] eq "a"
$tag->[1]{"href"}
$tag->[1]{"href"} =~ m[/language/[a-z]{2}]i
Truth table0%0/4
A and B and C
A= $tag->[0] eq "a"B= $tag->[1]{"href"}C= $tag->[1]{"href"} =~ m[/language/[a-z]{2}]i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | $text =~ s/\n//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | push @languages, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | ▶ | last if $tag->[0] eq '/div'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | $self->{_language} = \@languages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | return $self->{_language}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | =item also_known_as() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | Retrieve AKA information as array, each element of which is string: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | my $aka = $film->also_known_as(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | print map { "$_\n" } @$aka; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | sub also_known_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
also_known_as: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | my CLASS_NAME $self= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | ▶ | unless($self->{_also_known_as}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 0 | ▶ | while(my $tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | $self->_show_message("AKA: $text", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | ▶ | last if $text =~ /^(aka|also known as)/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | my $aka = $parser->get_trimmed_text('span'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 0 | $self->_show_message("AKA: $aka", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | my @aka = ($aka); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | $self->{_also_known_as} = \@aka; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 0 | return $self->{_also_known_as}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | =item trivia() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | Retrieve a movie trivia: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | my $trivia = $film->trivia(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | ▶ | sub trivia { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trivia: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | ▶ | $self->{_trivia} = $self->_get_simple_prop('trivia') unless $self->{_trivia}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 0 | return $self->{_trivia}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | =item goofs() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | Retrieve a movie goofs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | my $goofs = $film->goofs(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | ▶ | sub goofs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
goofs: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | ▶ | $self->{_goofs} = $self->_get_simple_prop('goofs') unless($self->{_goofs}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | return $self->{_goofs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | =item awards() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | Retrieve a general information about movie awards like 1 win & 1 nomination: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | my $awards = $film->awards(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | ▶ | sub awards { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
awards: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | return $self->{_top_info}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | =item mpaa_info() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | Return a MPAA for the specified move: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | my mpaa = $film->mpaa_info(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | ▶ | sub mpaa_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mpaa_info: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | unless($self->{_mpaa_info}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | ▶ | while(my $tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my $text = $parser->get_trimmed_text(MAIN_TAG, '/a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | ▶ | last if $text =~ /^Motion Picture Rating/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | my $mpaa = $parser->get_trimmed_text('/span'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | $mpaa =~ s/^\)\s//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 0 | $self->{_mpaa_info} = $mpaa; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | return $self->{_mpaa_info}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | =item aspect_ratio() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | Returns an aspect ratio of specified movie: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | my $aspect_ratio = $film->aspect_ratio(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | ▶ | sub aspect_ratio { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
aspect_ratio: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 0 | ▶ | $self->{_aspect_ratio} = $self->_get_simple_prop('aspect ratio') unless $self->{_aspect_ratio}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | return $self->{_aspect_ratio}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | =item summary() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | Retrieve film user summary: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | my $descr = $film->summary(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 0 | ▶ | sub summary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | my($tag, $text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | my($parser) = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | ▶ | while($tag = $parser->get_tag('b')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | ▶ | last if $text =~ /^summary/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 0 | $text = $parser->get_text('b', 'a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 0 | $self->{_summary} = $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | return $self->{_summary}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | =item certifications() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | Retrieve list of film certifications each element of which is hash reference - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | { country => certificate }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | my @cert = $film->certifications(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | ▶ | sub certifications { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
certifications: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 0 | ▶ | my $forced = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | my (%cert_list, $tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | ▶ | if($forced) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | ▶ | while($tag = $parser->get_tag(MAIN_TAG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | ▶ | last if $parser->get_text =~ /certification/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | ▶ | while($tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 0 | ▶ | if($tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ /certificates/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ /certificates/i
$tag->[0] eq "a" and $tag->[1]{"href"}
MC/DC0%0/3
$tag->[0] eq "a" and $tag->[1]{"href"} and $tag->[1]{"href"} =~ /certificates/i
$tag->[0] eq "a"
$tag->[1]{"href"}
$tag->[1]{"href"} =~ /certificates/i
Truth table0%0/4
A and B and C
A= $tag->[0] eq "a"B= $tag->[1]{"href"}C= $tag->[1]{"href"} =~ /certificates/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | $text =~ s/\n//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 0 | my($country, $range) = split /\:/, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | $cert_list{$country} = $range; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 0 | ▶ | last if $tag->[0] eq '/td'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 0 | $self->{_certifications} = \%cert_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | return $self->{_certifications}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | =item full_plot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | Return full movie plot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | my $full_plot = $film->full_plot(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 0 | ▶ | sub full_plot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
full_plot: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 0 | $self->_show_message("Getting full plot ".$self->code."; url=".$self->full_plot_url." ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | # TODO: move all methods which needed additional connection to the IMDB.com | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | # to the separate module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 0 | ▶ | unless($self->{_full_plot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | ▶ | $page = $self->_cacheObj->get($self->code.'_plot') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | my $url = $self->full_plot_url . $self->code() . '/plotsummary'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 0 | $self->_show_message("URL is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 0 | ▶ | $self->_cacheObj->set($self->code.'_plot', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | my($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | ▶ | while(my $tag = $parser->get_tag('p')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | ▶ | if(defined $tag->[1]{class} && $tag->[1]{class} =~ /plotpar/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $tag->[1]{"class"} and $tag->[1]{"class"} =~ /plotpar/i
MC/DC0%0/2
defined $tag->[1]{"class"} and $tag->[1]{"class"} =~ /plotpar/i
defined $tag->[1]{"class"}
$tag->[1]{"class"} =~ /plotpar/i
Truth table0%0/3
A and B
A= defined $tag->[1]{"class"}B= $tag->[1]{"class"} =~ /plotpar/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | $text = $parser->get_trimmed_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | $self->{_full_plot} = $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | return $self->{_full_plot}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 0 | ▶ | sub big_cover { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
big_cover: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 0 | ▶ | unless($self->{'_big_cover_url'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | ▶ | unless($self->{'_big_cover_page'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | my $parser = $self->_parser(FORCED); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 0 | my $regexp = '^/media/.+/tt' . $self->code . '$'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | ▶ | while(my $tag = $parser->get_tag('a')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 0 | $self->_show_message("$regexp --> " . $tag->[1]->{href}, 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 0 | ▶ | if($tag->[1]->{'href'} =~ m!$regexp!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 0 | $self->{'_big_cover_page'} = $tag->[1]->{'href'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 0 | ▶ | if($self->{'_big_cover_page'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 0 | my $page = $self->_get_page_from_internet('http://' . $self->{'host'} . $self->{'_big_cover_page'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 0 | ▶ | return unless $page; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 0 | ▶ | while(my $tag = $parser->get_tag('img')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | ▶ | if($tag->[1]->{'id'} && $tag->[1]->{'id'} eq 'primary-img') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"id"} and $tag->[1]{"id"} eq "primary-img"
MC/DC0%0/2
$tag->[1]{"id"} and $tag->[1]{"id"} eq "primary-img"
$tag->[1]{"id"}
$tag->[1]{"id"} eq "primary-img"
Truth table0%0/3
A and B
A= $tag->[1]{"id"}B= $tag->[1]{"id"} eq "primary-img"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 0 | $self->{'_big_cover_url'} = $tag->[1]->{'src'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 0 | return $self->{_big_cover_url}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | =item official_sites() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | Returns a list of official sites of specified movie as array reference which contains hashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | with site information - URL => Site Title: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | my $sites = $film->official_sites(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | for(@$sites) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | print "Site name - $_->{title}; url - $_->{url}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 0 | ▶ | sub official_sites { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
official_sites: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 0 | ▶ | unless($self->{_official_sites}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 0 | ▶ | $page = $self->_cacheObj->get($self->code . '_sites') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 0 | my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/officialsites"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 0 | $self->_show_message("URL for sites is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 0 | ▶ | $self->_cacheObj->set($self->code.'_sites', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 0 | ▶ | while(my $tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 0 | ▶ | last if $tag->[0] eq 'ol'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | 0 | ▶ | while(my $tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 0 | ▶ | if($tag->[0] eq 'a' && $tag->[1]->{href} !~ /sections/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[0] eq "a" and not $tag->[1]{"href"} =~ /sections/i
MC/DC0%0/2
$tag->[0] eq "a" and not $tag->[1]{"href"} =~ /sections/i
$tag->[0] eq "a"
not $tag->[1]{"href"} =~ /sections/i
Truth table0%0/3
A and not(B)
A= $tag->[0] eq "a"B= not $tag->[1]{"href"} =~ /sections/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | push @{ $self->{_official_sites} }, { $tag->[1]->{href} => $text }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | 0 | ▶ | last if $tag->[0] eq '/ol' or $tag->[0] eq 'hr'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[0] eq "/ol" or $tag->[0] eq "hr"
MC/DC0%0/2
$tag->[0] eq "/ol" or $tag->[0] eq "hr"
$tag->[0] eq "/ol"
$tag->[0] eq "hr"
Truth table0%0/3
A or B
A= $tag->[0] eq "/ol"B= $tag->[0] eq "hr"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | return $self->{_official_sites}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | =item release_dates() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | Returns a list of release dates of specified movie as array reference: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | my $sites = $film->release_dates(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | for(@$sites) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | print "Country - $_->{country}; release date - $_->{date}; info - $_->{info}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | Option info contains additional information about release - DVD premiere, re-release, restored version etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | ▶ | sub release_dates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
release_dates: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 0 | ▶ | unless($self->{_release_dates}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 0 | ▶ | $page = $self->_cacheObj->get($self->code . '_dates') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 0 | my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/releaseinfo"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 0 | $self->_show_message("URL for sites is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 0 | ▶ | $self->_cacheObj->set($self->code.'_dates', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | # Searching header of release dates table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 0 | ▶ | while(my $tag = $parser->get_tag('th')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 0 | ▶ | last if $tag->[1]->{class} && $tag->[1]->{class} eq 'xxxx'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"class"} and $tag->[1]{"class"} eq "xxxx"
MC/DC0%0/2
$tag->[1]{"class"} and $tag->[1]{"class"} eq "xxxx"
$tag->[1]{"class"}
$tag->[1]{"class"} eq "xxxx"
Truth table0%0/3
A and B
A= $tag->[1]{"class"}B= $tag->[1]{"class"} eq "xxxx"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | # The table has three columns. So we parse then one by one and grab their text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 0 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 0 | my @dates = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 0 | ▶ | while(my $tag = $parser->get_tag()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 0 | ▶ | last if $tag->[0] eq '/table'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 0 | ▶ | next unless $tag->[0] eq 'td'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 0 | $dates[$count] = $parser->get_trimmed_text('/td'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | # When rish 3rd column we should store dates into object property | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | ▶ | if(++$count > 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | $dates[2] =~ s/\)\s\(/, /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 0 | $dates[2] =~ s/(\(|\))//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 0 | push @{ $self->{_release_dates} }, {country => $dates[0], date => $dates[1], info => $dates[2]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 0 | $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 0 | return $self->{_release_dates}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | =item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | Retrieve a list of plot keywords as an array reference: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | my $plot_keywords = $film->plot_keywords(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | for my $keyword (@$plot_keywords) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | print "keyword: $keyword\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | ▶ | sub plot_keywords { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plot_keywords: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 0 | ▶ | unless($self->{_plot_keywords}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 0 | my $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 0 | ▶ | $page = $self->_cacheObj->get($self->code . '_keywords') if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 0 | ▶ | unless($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 0 | my $url = "http://". $self->{host} . "/" . $self->{query} . $self->code . "/keywords"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 0 | $self->_show_message("URL for sites is $url ...", 'DEBUG'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | $page = $self->_get_page_from_internet($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | ▶ | $self->_cacheObj->set($self->code.'_keywords', $page, $self->_cache_exp) if $self->_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 0 | my $parser = $self->_parser(FORCED, \$page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 0 | my @keywords = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 0 | ▶ | while(my $tag = $parser->get_tag('a')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 0 | my $text = $parser->get_text(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 0 | $text = $self->_decode_special_symbols($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | #$self->_show_message("*** $tag->[1]->{href} --> $text ***", 'DEBUG'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | ▶ | push @keywords, $text if $tag->[1]->{href} && $tag->[1]->{href} =~ m#/keyword/#; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag->[1]{"href"} and $tag->[1]{"href"} =~ m[/keyword/]
MC/DC0%0/2
$tag->[1]{"href"} and $tag->[1]{"href"} =~ m[/keyword/]
$tag->[1]{"href"}
$tag->[1]{"href"} =~ m[/keyword/]
Truth table0%0/3
A and B
A= $tag->[1]{"href"}B= $tag->[1]{"href"} =~ m[/keyword/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | $self->{_plot_keywords} = \@keywords; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | return $self->{_plot_keywords}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | my CLASS_NAME $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||