Apr 8, 2004 #1 mountainbiker Programmer Joined Aug 21, 2002 Messages 122 Location GB I was wondering if anyone has a clean, niffy way of reading in an HTML file's meta data and stuff it into a hash?
I was wondering if anyone has a clean, niffy way of reading in an HTML file's meta data and stuff it into a hash?
Apr 8, 2004 Thread starter #2 mountainbiker Programmer Joined Aug 21, 2002 Messages 122 Location GB Code: sub getMetaData { die "$!\n" if ( ! open(HTML, "$@_[0]") ); my %data = map { /meta name="(.*)" content="(.*)"/is } <HTML>; # print "$_ => $data{$_}\n" for keys %data; return \%data; } Upvote 0 Downvote
Code: sub getMetaData { die "$!\n" if ( ! open(HTML, "$@_[0]") ); my %data = map { /meta name="(.*)" content="(.*)"/is } <HTML>; # print "$_ => $data{$_}\n" for keys %data; return \%data; }
Apr 9, 2004 #3 missbarbell Programmer Joined Aug 1, 2001 Messages 457 Location GB You mean something like HTML::TokeParser? Barbie Leader of Birmingham Perl Mongers http://birmingham.pm.org Upvote 0 Downvote
You mean something like HTML::TokeParser? Barbie Leader of Birmingham Perl Mongers http://birmingham.pm.org
Apr 9, 2004 Thread starter #4 mountainbiker Programmer Joined Aug 21, 2002 Messages 122 Location GB Way cool Barbie. A very handy module. Have a nice Easter. Upvote 0 Downvote