Hi,
I've got this code from an example in PerlDoc. It's a package to test HTML::Filter. From the manual, it says this package will count table tags and then make output not happen when inside a table.
package TableStripper;
require HTML::Filter;
@ISA = qw(HTML::Filter);
sub start {
my $self = shift;
if ($_[0] eq "table"
{
$self->{table_seen}++;
print $self->{table_seen};
}
$self->SUPER::start(@_);
}
sub end {
my $self = shift;
$self->SUPER::end(@_);
if ($_[0] eq "table"
{
$self->{table_seen}--;
print $self->{table_seen};
}
}
sub output {
my $self = shift;
unless ($self->{table_seen}) {
$self->SUPER:
utput(@_);
}
}
1;
and the caller is
use TableStripper;
$p = TableStripper->new->parse_file("LWPUserAgent.html"
;
I have got nothing returned so I don't know if there is anything wrong with my code. Any suggestion??
I've got this code from an example in PerlDoc. It's a package to test HTML::Filter. From the manual, it says this package will count table tags and then make output not happen when inside a table.
package TableStripper;
require HTML::Filter;
@ISA = qw(HTML::Filter);
sub start {
my $self = shift;
if ($_[0] eq "table"
$self->{table_seen}++;
print $self->{table_seen};
}
$self->SUPER::start(@_);
}
sub end {
my $self = shift;
$self->SUPER::end(@_);
if ($_[0] eq "table"
$self->{table_seen}--;
print $self->{table_seen};
}
}
sub output {
my $self = shift;
unless ($self->{table_seen}) {
$self->SUPER:
}
}
1;
and the caller is
use TableStripper;
$p = TableStripper->new->parse_file("LWPUserAgent.html"
I have got nothing returned so I don't know if there is anything wrong with my code. Any suggestion??