On Thu Jan 27 18:19:32 2011, ron7 wrote:
Show quoted text> Noticed recently that the certifications() method was no longer
> returning an array. From the source, it appears that the info
gathered
Show quoted text> must once have been on the retrieved page in a <table>. The current
page
Show quoted text> structure hyperlinks this data.
>
> Data on the certificates page are rather complex, so understand if
this
Show quoted text> bug gets a "won't fix" classification.
A possible fix (not the best, but works for me):
sub certifications {
my CLASS_NAME $self = shift;
my $forced = shift || 0;
my (%cert_list, $tag);
my $url = "http://". $self->{host} . "/" . $self->{query} . $self-
Show quoted text>code . "/parentalguide#certification";
my $data = LWP::Simple::get($url);
my $parser = new HTML::TokeParser(\$data) or croak "[CRITICAL] Cannot
create HTML parser: $!!";
while ($tag = $parser->get_tag('h5')) {
my $txt = $parser->get_text;
if ($txt =~ /certification/i) {
$parser->get_tag('div');
while ($tag = $parser->get_tag()) {
last if ($tag->[0] eq 'h3');
if ($tag->[0] eq 'a') {
$txt = $parser->get_text;
my($country, $range) = split /\:/, $txt;
$cert_list{$country} = $range;
debug(0,"$country = $range\n");
}
}
$self->{_certifications} = \%cert_list;
}
}
return $self->{_certifications};
}