Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: perl threads exiting abnormally

by Lotus1 (Chaplain)
on Nov 23, 2012 at 15:21 UTC ( #1005280=note: print w/ replies, xml ) Need Help??


in reply to Re: perl threads exiting abnormally
in thread perl threads exiting abnormally

  • Why did you put a 'do' block inside a while loop? The while loop is going to do the block inside it anyway.

  • $workq->end();
    I couldn't replicate your error.

    There is no end() method listed in the POD for Thread::Queue. Did you test this code? I got a 'Can't locate object method "end"...' warning for this line.

  • $workq->enqueue($urls[0], $urls[1], $urls[2]);

    Why not this? $workq->enqueue(@urls);

  • while(defined(my $url = $workq->dequeue)) { do { my $ua = LWP::UserAgent->new; foreach my $url (@urls) {
    You get $url from $workq then override it with each of the urls from @urls? Wouldn't this make each thread access every url?


Comment on Re^2: perl threads exiting abnormally
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005280]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-12-18 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (44 votes), past polls