gisle/http-message — pull request #1 by madsen (2012-02-19 09:08:28+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 itself has no non-core dependencies with Perl 5.8.7+, unlike HTTP::Parser, which requires a C compiler. It works with earlier versions of Perl 5.8, but you need to upgrade Encode (to at least
version 2.10), and you may need to upgrade Exporter (to at least version 5.57).

However, the code I've added to HTTP::Message uses `mime_name`, which wasn't introduced until Encode 2.21. That means Perl 5.8.9 or 5.10.0 (or updating Encode with an earlier version of Perl).

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`.

This pull request replaces gisle/libwww-perl#24. The code is the same.