use strict; package HTMLSearch; use vars qw(@ISA); @ISA = qw(HTML::Parser); require HTML::Parser; sub new { my $this = shift; my $class = ref($this) || $this; my $self = $this->SUPER::new(); $self->{FOUND} = undef; $self->{SEARCH} = undef; return bless($self,$class); } sub search { my ($self,$file,$search) = @_; $self->{SEARCH} = $search; $self->parse_file($file); return $self->{FOUND}; } sub text { my ($self, $text) = @_; $self->{FOUND} += $text =~ /$self->{SEARCH}/s; } 1;