- $p = HTML::Parser->new(api_version => 3);
-
- $p->handler(start => \@accum, "tagname, attr");
- $p->report_tags(qw(meta));
- $p->utf8_mode(1);
- $p->parse($content);
-
- # Look for the title in the meta tags
- foreach $t (@accum) {
- if ('meta' eq $t->[0]) {
- if (exists($t->[1]->{'name'}) and ('title' eq $t->[1]->{'name'})) {
- $metadata->{'TITLE'} = $t->[1]->{'content'};
- }
- }