[libanyevent-rabbitmq-perl] 66/151: Drop the dependency on Coro
Damyan Ivanov
dmn at moszumanska.debian.org
Thu Jan 16 11:03:04 UTC 2014
This is an automated email from the git hooks/post-receive script.
dmn pushed a commit to annotated tag debian/1.12-1
in repository libanyevent-rabbitmq-perl.
commit 9e66586e5e0b0a9ebf2b157fa9dc92cb340a324b
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Tue Dec 14 03:39:22 2010 +0000
Drop the dependency on Coro
---
Makefile.PL | 2 --
lib/Net/RabbitFoot.pm | 11 +++++------
lib/Net/RabbitFoot/Channel.pm | 12 +++++-------
lib/Net/RabbitFoot/Cmd/Role/Command.pm | 21 +++++++++++++--------
xt/05_coro.t | 2 +-
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 744778a..5274ba9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -12,8 +12,6 @@ requires 'JSON::XS';
requires 'List::MoreUtils';
requires 'Net::AMQP';
requires 'AnyEvent';
-requires 'Coro';
-requires 'Coro::AnyEvent';
requires 'File::ShareDir';
requires 'Devel::GlobalDestruction';
diff --git a/lib/Net/RabbitFoot.pm b/lib/Net/RabbitFoot.pm
index 280ae97..8319091 100644
--- a/lib/Net/RabbitFoot.pm
+++ b/lib/Net/RabbitFoot.pm
@@ -3,9 +3,8 @@ package Net::RabbitFoot;
use strict;
use warnings;
+use AnyEvent;
use AnyEvent::RabbitMQ;
-use Coro;
-use Coro::AnyEvent;
use File::ShareDir ();
@@ -54,12 +53,12 @@ sub _do {
my $method = shift;
my %args = @_;
- my $cb = Coro::rouse_cb;
- $args{on_success} = sub {$cb->(1, @_);},
- $args{on_failure} = sub {$cb->(0, @_);},
+ my $cv = AnyEvent->condvar;
+ $args{on_success} = sub {$cv->send(1, @_);},
+ $args{on_failure} = sub {$cv->send(0, @_);},
$self->{_ar}->$method(%args);
- my ($is_success, @responses) = Coro::rouse_wait;
+ my ($is_success, @responses) = $cv->recv;
die @responses if !$is_success;
return @responses;
}
diff --git a/lib/Net/RabbitFoot/Channel.pm b/lib/Net/RabbitFoot/Channel.pm
index a2dea7b..d6a379f 100644
--- a/lib/Net/RabbitFoot/Channel.pm
+++ b/lib/Net/RabbitFoot/Channel.pm
@@ -3,9 +3,7 @@ package Net::RabbitFoot::Channel;
use strict;
use warnings;
-use Coro;
-use Coro::AnyEvent;
-
+use AnyEvent;
use AnyEvent::RabbitMQ::Channel;
our $VERSION = '1.02';
@@ -23,12 +21,12 @@ BEGIN {
my $self = shift;
my %args = @_;
- my $cb = Coro::rouse_cb;
- $args{on_success} = sub {$cb->(1, @_);},
- $args{on_failure} = sub {$cb->(0, @_);},
+ my $cv = AnyEvent->condvar;
+ $args{on_success} = sub {$cv->send(1, @_);},
+ $args{on_failure} = sub {$cv->send(0, @_);},
$self->{arc}->$method(%args);
- my ($is_success, @responses) = Coro::rouse_wait;
+ my ($is_success, @responses) = $cv->recv;
die @responses if !$is_success;
return $responses[0];
};
diff --git a/lib/Net/RabbitFoot/Cmd/Role/Command.pm b/lib/Net/RabbitFoot/Cmd/Role/Command.pm
index e845eb3..b844841 100644
--- a/lib/Net/RabbitFoot/Cmd/Role/Command.pm
+++ b/lib/Net/RabbitFoot/Cmd/Role/Command.pm
@@ -1,7 +1,6 @@
package Net::RabbitFoot::Cmd::Role::Command;
use FindBin;
-use Coro;
use Net::RabbitFoot;
use Moose::Role;
@@ -122,17 +121,23 @@ sub execute {
)->connect(
(map {$_ => $self->$_} qw(host port user pass vhost)),
timeout => 5,
- on_close => unblock_sub {
- $self->_close(shift);
- exit; # FIXME
+ on_close => sub {
+ my $w; $w = AnyEvent->idle(cb => sub {
+ undef $w;
+ $self->_close(shift);
+ exit; # FIXME
+ });
},
);
my $ch = $rf->open_channel(
- on_close => unblock_sub {
- $self->_close(shift);
- $rf->close;
- exit;
+ on_close => sub {
+ my $w; $w = AnyEvent->idle(cb => sub {
+ undef $w;
+ $self->_close(shift);
+ $rf->close;
+ exit;
+ });
},
);
diff --git a/xt/05_coro.t b/xt/05_coro.t
index db6aa27..a566b4f 100644
--- a/xt/05_coro.t
+++ b/xt/05_coro.t
@@ -35,7 +35,7 @@ my $rf = Net::RabbitFoot->new();
lives_ok sub {
$rf->load_xml_spec(Net::RabbitFoot::default_amqp_spec())
}, 'load xml spec';
-
+
lives_ok sub {
$rf->connect(
(map {$_ => $conf->{$_}} qw(host port user pass vhost)),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-rabbitmq-perl.git
More information about the Pkg-perl-cvs-commits
mailing list