in reply to HTML::TokeParser- Meta Tags
gives me:use HTML::TokeParser; local $/; my $content = <DATA>; my $p = HTML::TokeParser->new(\$content); my %meta; while (my $token = $p->get_token) { next if $token->[1] ne 'meta' && $token->[0] ne 'S'; $meta{$token->[2]{name}} = $token->[2]{content}; } print "$_: $meta{$_}\n" foreach (keys %meta); __DATA__ <meta name="copyright" content="Aaron Anderson"> <meta name="keywords" content="free, cheap, fun">
Update: Took out lc() from around $token->[1], since all tags are ensured to be lowercase -- so says PodMaster! =)keywords: free, cheap, fun copyright: Aaron Anderson
|
|---|