Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML::Filter problem

Status
Not open for further replies.

rubis

Programmer
Jun 21, 2001
54
GB
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::eek: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??

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top