[libanyevent-rabbitmq-perl] 38/151: Hacky hacky way to get my own on_failure callback called when everything shits itself..

Damyan Ivanov dmn at moszumanska.debian.org
Thu Jan 16 11:03:02 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 b1313b01df306c57c11cc6c1c5bc954f97c7d7e6
Author: Tomas Doran <bobtfish at bobtfish.net>
Date:   Tue Mar 9 21:36:44 2010 +0000

    Hacky hacky way to get my own on_failure callback called when everything shits itself..
---
 lib/Net/RabbitFoot.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/Net/RabbitFoot.pm b/lib/Net/RabbitFoot.pm
index 0697277..f6d8ccc 100644
--- a/lib/Net/RabbitFoot.pm
+++ b/lib/Net/RabbitFoot.pm
@@ -55,8 +55,13 @@ sub _do {
     my %args   = @_;
 
     my $cb = Coro::rouse_cb;
-    $args{on_success} = sub {$cb->(1, @_);},
-    $args{on_failure} = sub {$cb->(0, @_);},
+    $args{on_success} = sub {$cb->(1, @_);};
+
+    my $on_failure = sub {$cb->(0, @_);};
+    if (my $previous_cb = $args{on_failure}) {
+        $on_failure = sub { $cb->(0, @_); goto $previous_cb };
+    }
+    $args{on_failure} = $on_failure,
 
     $self->{_ar}->$method(%args);
     my ($is_success, @responses) = Coro::rouse_wait;

-- 
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