Tkil <[EMAIL PROTECTED]> writes:
> looking over my solution to this small question, i was left curious
> about something: is there any particular reason why the "declaration"
> method in HTML::Parser doesn't have an $origtext argument, other than
> the fact that it's easier than most to reconstruct?
No. I just ended up that way.
> i've often found myself in a situation where i want to mostly do a
> "pass-through" parser, modifying only certain tags, certain links,
> turning pass-through on and off, etc. the $origtext parameters make
> this quete painless (and i suspect the new XS modules make it even
> easier) but this anomaly happened to catch my attention tonight.
In the old parser modules we had HTML::Filter to help you with this
stuff, but HTML-Parser-3.xx has better ways. Here you would simply
set up a 'default' handler that pass through the text unchanged.
This is the comment stripper example:
use HTML::Parser;
HTML::Parser->new(default_h => [sub { print shift }, 'text'],
comment_h => [""],
)->parse_file(shift || die) || die $!;
Regards,
Gisle