Problem with blocking
Oliver Block <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am using HTML::Parser to extract Hyperlinks from a Web Page. I wrote a
Module MyParser wich is based on the above quoted Perl module.
Now I want to ensure, that the Parser finished his work before I query the
links. I have a member function getHyperlinks which returns a hash containing
the links. No big thing:
$p->parse;
my %links = $p->getHyperlinks;
I thougt that the parser may still parse, so I assigned a boolean variable
$isParsing which is set to true by the start_document handler and set to
false by the end_document handler.
sub getHyperlinks {
my $self = shift;
while($isParsing) { }
return %{self->{HYPERLINKS}};
}
Actually the parser seems to be blocking now. What is the best way to ensure
that the parser finished extracting all links without blocking the whole
thing?
Best Regards,
Oliver