Subject: | Deprecated use of "use attrs" in Pool.pm |
Date: | Thu, 7 Apr 2011 09:33:48 -0700 |
To: | bug-Thread-Pool [...] rt.cpan.org |
From: | David Karr <davidmichaelkarr [...] gmail.com> |
Distribution: ThreadPool-0.1
Perl version: 5.10.0
OS: WinXPSP3, Cygwin 1.5.25
After adding the use of "Thread::Pool" to my script, I'm seeing the
following at startup:
pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead at
/usr/lib/perl5/site_perl/5.10/Thread/Pool.pm line 98.
pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead at
/usr/lib/perl5/site_perl/5.10/Thread/Pool.pm line 107.
pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead at
/usr/lib/perl5/site_perl/5.10/Thread/Pool.pm line 114.
pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead at
/usr/lib/perl5/site_perl/5.10/Thread/Pool.pm line 127.
pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead at
/usr/lib/perl5/site_perl/5.10/Thread/Pool.pm line 136.
After looking up some history on this, it appears this is a valid warning,
as the usage in the "Pool.pm" package is deprecated. One sample:
sub _next_job {
use attrs qw(locked method);
my $pool = shift;
cond_wait($pool) while $pool->{num} <= $pool->{min} &&
!@{$pool->{jobs}};
my $job = $pool->{jobs}->[0];
shift @{$pool->{jobs}} if defined $job;
return $job;
}
This should be changed to:
sub _next_job : locked : method {
my $pool = shift;
cond_wait($pool) while $pool->{num} <= $pool->{min} &&
!@{$pool->{jobs}};
my $job = $pool->{jobs}->[0];
shift @{$pool->{jobs}} if defined $job;
return $job;
}