package TableThing; use strict; use vars qw(@ISA $infield $inrecord $intable); @ISA = qw(HTML::Parser); require HTML::Parser; sub start() { my($self,$tag,$attr,$attrseq,$orig) = @_; if ($tag eq 'table') { $self->{Table} = (); $intable++; } if ( $tag eq 'tr' ) { $self->{Row} = (); $inrecord++ ; } if ( $tag eq 'td' ) { $self->{Field} = ''; $infield++; } } sub text() { my ($self,$text) = @_; if ($intable && $inrecord && $infield ) { $self->{Field} .= $text; } } sub end() { my ($self,$tag) = @_; $intable-- if($tag eq 'table'); if($tag eq 'td') { $infield--; push @{$self->{Row}},$self->{Field}; } if($tag eq 'tr') { $infield--; push @{$self->{Table}},\@{$self->{Row}}; } } 1;