Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Monday June 09, 2003
08:11 PM

Can't stop tweaking

[ #12714 ]

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=#0000ff
#     BGCOLOR=#ffffff class='none'>
print $token->as_is;
# <body alink="#0000ff" bgcolor="#ffffff" class="none">

It will put the entire tag on one line, though.

Thus, to clean up an entire doc:

while (my $token = $parser->get_token) {
    $token->rewrite_tag; # no tag testing required
    print $token->as_is;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.