> How would I implement this example to parse an HTML file? I know I'm
> missing something because I don't see a place in the module, or
> whatever this is, for the HTML file to be referenced. Just assume I
> know very little.
> package CommentStripper;
> require HTML::Filter;
> @ISA=qw(HTML::Filter);
> sub comment { } # ignore comments
>
> I have ActiveState 5.8 installed, but I'm a complete n00b, if that
? wasn't already obvious.
Here, the comment handling method named comment() of HTML::Filter is
overridden in the new class CommentStripper. The new method does nothing
(one way to easily ignore comments). All the other methods of HTML::Filter
will still be accessible to CommentStripper class. See 'perldoc perlboot'
Use it like:
#! /usr/bin/perl
use strict;
use warnings;
use lib "."; # Assuming CommentStripper.pm is in $PWD
use CommentStripper;
my $p = CommentStripper->new->parse_file( "my.html" );
> Thanks,
HTH,
Gowtham
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/