Subject: | Support for perl <5.14 |
Hi,
Minor patch if you're interested in support for pre-5.14 perl versions,
mainly package {} and shift $arrayref.
cheers,
Tom
Subject: | async-resourcepool-perl514.patch |
diff -uNPr Async-ResourcePool-v0.1.1-original/lib/Async/ResourcePool.pm Async-ResourcePool-v0.1.1-4AfCub/lib/Async/ResourcePool.pm
--- Async-ResourcePool-v0.1.1-original/lib/Async/ResourcePool.pm 2012-08-31 22:30:00.000000000 +0100
+++ Async-ResourcePool-v0.1.1-4AfCub/lib/Async/ResourcePool.pm 2012-09-01 15:43:20.908194871 +0100
@@ -142,7 +142,7 @@
my ($self) = @_;
if ($self->has_waiters) {
- $self->lease(shift $self->{_wait_queue});
+ $self->lease(shift @{$self->{_wait_queue}});
}
}
@@ -161,7 +161,7 @@
my ($self, $callback) = @_;
if ($self->has_available) {
- my $resource = shift $self->{_available};
+ my $resource = shift @{$self->{_available}};
$callback->($resource);
}
@@ -214,7 +214,7 @@
# This may mean they've been invalidated.
if ($self->{_resources}{$resource}) {
if ($self->has_waiters) {
- my $callback = shift $self->{_wait_queue};
+ my $callback = shift @{$self->{_wait_queue}};
$callback->($resource);
}
diff -uNPr Async-ResourcePool-v0.1.1-original/t/core.t Async-ResourcePool-v0.1.1-4AfCub/t/core.t
--- Async-ResourcePool-v0.1.1-original/t/core.t 2012-08-31 22:30:00.000000000 +0100
+++ Async-ResourcePool-v0.1.1-4AfCub/t/core.t 2012-09-01 15:48:31.407085532 +0100
@@ -15,7 +15,7 @@
use_ok("Async::ResourcePool", "Able to include module");
-package Resource {
+{ package Resource;
our $instances = 0;
use Test::More;
@@ -74,7 +74,7 @@
}
}
-our @queue;
+my @queue;
sub postpone (&) {
splice @queue, rand(@queue), 0, shift;