sub patched_cast {
my IMDB::Film $self = shift;
- my ($forced) = shift || 0;
-
- if($forced) {
- my (@cast, $tag, $person, $id, $role);
- my $parser = $self->_parser(1);
-
- while($tag = $parser->get_tag('table')) {
- last if $tag->[1]->{class} && $tag->[1]->{class} =~ /^cast_list$/i;
- }
- while($tag = $parser->get_tag()) {
- last if $tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ /fullcredits/i;
- # if($tag->[0] eq 'td' && $tag->[1]{class} && $tag->[1]{class} eq 'name') {
- $tag = $parser->get_tag('a');
- if($tag->[1]{href} && $tag->[1]{href} =~ m#name/nm(\d+?)/#) {
- $person = $parser->get_text;
- $id = $1;
- my $text = $parser->get_trimmed_text('/tr');
- ($role) = $text =~ /\.\.\. (.*)$/;
- push @cast, {id => $id, name => $person, role => $role} if $person;
- }
- # }
- }
-
- $self->{_cast} = \@cast;
+
+ my (@cast, $tag, $person, $id, $role);
+ my $parser = $self->_parser(1);
+
+ while($tag = $parser->get_tag('table')) {
+ last if $tag->[1]->{class} && $tag->[1]->{class} =~ /^cast_list$/i;
+ }
+ while($tag = $parser->get_tag()) {
+ last if $tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ /fullcredits/i;
+ # if($tag->[0] eq 'td' && $tag->[1]{class} && $tag->[1]{class} eq 'name') {
+ $tag = $parser->get_tag('a');
+ if($tag->[1]{href} && $tag->[1]{href} =~ m#name/nm(\d+?)/#) {
+ $person = $parser->get_text;
+ $id = $1;
+ my $text = $parser->get_trimmed_text('/tr');
+ ($role) = $text =~ /\.\.\. (.*)$/;
+ push @cast, {id => $id, name => $person, role => $role} if $person;
+ }
+ # }
}
- return $self->{_cast};
+ \@cast
}
sub add_film {