HTML::TokeParser::Simple 2.1 has just been uploaded to the CPAN. A friend asked why I didn't make one of the private methods public and I couldn't see why not, so I did. The $token->rewrite_tag method automatically lowercases the tag name, attribute names, and properly quotes values. It ignores non tags.
# <body alink=#0000ffIt will put the entire tag on one line, though.
Thus, to clean up an entire doc:
while (my $token = $parser->get_token) {