Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Can't instantiate Thread::Pool

by alain_desilets (Beadle)
on Sep 20, 2011 at 14:52 UTC ( #926961=perlquestion: print w/replies, xml ) Need Help??
alain_desilets has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use Thread::Pool, and I am not even able to instantiate it! Here's the code:
use Thread::Pool; my $pool = Thread::Pool->new(Min => 5, Max => 10);
which is essentially the first two lines of the Synopsis for the module in the doc:

When I run the code, I get error message:

Can't bless non-reference value at C:/Perl/site/lib/Thread/ (loaded on demand from offset 2009 for 3872 bytes) line 90.

What am I doing wrong?


Replies are listed 'Best First'.
Re: Can't instantiate Thread::Pool
by Corion (Pope) on Sep 20, 2011 at 15:01 UTC

    The two lines you quoted are not "essentially the first two lines" of the synopsis. Looking at Thread::Pool, the first three lines are:

    use Thread::Pool; $pool = Thread::Pool->new( {

    So, likely ->new() takes a hashref instead of a list as arguments.

      Oh, I see. I was looking at the documentation for version 0.1:

      which was the first hit that came on Google. I now see that I should be using the doc for version 0.3:

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://926961]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-02-22 11:55 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (291 votes). Check out past polls.