Re: Problem with blocking

Oliver Block <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Am Dienstag, 25. April 2006 04:58 schrieb Andy Lester:
> > sub getHyperlinks {
> >    my $self = shift;
> >    while($isParsing) { }
> >    return %{self->{HYPERLINKS}};
> > }
>
> The while loop is empty.  Nothing can change the value of $isParsing.

That's right! At least not in the while loop.

The value is changed in the start_document_handler (true) and 
end_document_handler (false). The loop is just to ensure the parser is not 
parsing.

But possibly I got confused, because I was handling with the ithread module 
and with locking and semaphores the last days!? :)

..
$p->parse;
my %links = $p->getHyperlinks;
..

Is there a chance that the calling program calls $p->getHyperlinks while the 
parser is still parsing the page? Or isn't it that the $p->getHyperlinks is 
called after the $p->parse returned (though without a value).

I am sorry if I am confusing someone.

Best Regards,

Oliver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.