gnangia has asked for the wisdom of the Perl Monks concerning the following question:
Now I am not sure if I can pass my $text_to_match variable to the subroutine text or do I return $text and where abouts in the code would I do it?$parser = HTML::Parser->new(api_version => 3) $parser->handler(start => \&start,'self,tagname,attr'); $parser->handler(text => \&text,'self,text'); @todo = ["", $starturl]; while(@todo) { my ($refer, $url) = @{shift @todo} next if (exists $done{$url}); $request = GET $url, [referer=>$refer]; if ($response->is_success()) { $done{$url} = 1; $parser->{base} ||= $response->base; $parser->{browser} ||= $browser; $parser->parse($response->content); $parser->eof(); } .. } sub text { my ($self, $text)= @_; print $text . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need Help on HTML::Parser
by pg (Canon) on Nov 21, 2002 at 02:06 UTC |