gisle/libwww-perl — pull request #24 by madsen (2012-01-28 22:06:07+00:00)
Title: Use IO::HTML for <meta> encoding sniffing

Now that I've released [IO::HTML](http://search.cpan.org/perldoc?IO::HTML), here's a patch to make HTTP::Message use it instead of HTTP::Parser for encoding detection using HTML tags. IO::HTML has no non-core dependencies with Perl 5.8.3+, unlike HTTP::Parser, which requires a C compiler.

Note: The previous version of HTTP::Message did not require http-equiv="Content-Type", just "charset=" inside a `content` attribute. That is laxer than the [current HTML5 spec](http://www.w3.org/TR/html5/parsing.html#determining-the-character-encoding). (I haven't checked to see if the spec has changed since you implemented the algorithm.) If you want to match the HTML5 spec, remove the `need_pragma => 0` from the call to `find_charset_in`.