sub getHTML {
my( $Qin ) = @_;
## Read a link
## The threads block here until links are available.
while( my $link = $Qin->dequeue ) {
## Fetch the content
my $content = get $link;
## And process it
retrieveInfo( $content );
}
}
####
sub listParse {
my( $url, $Qout ) = @_;
## Get the first page
my $content = get $url;
## find the links and push them onto the queue
while( $content =~ m[...]g ) {
$Qout->enqueue( $_ ); ### Links added to queue here.
}
## Push 1 undef per thread to terminate their loops
$Qout->enqueue( (undef) x $noOfThreads );
}
####
## Join the threads
$_->join for @threads;