[libanyevent-rabbitmq-perl] 21/151: Fixed an argument for new and connect methods.

Damyan Ivanov dmn at moszumanska.debian.org
Thu Jan 16 11:03:01 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 9b0db66fd4eca76db2b5a9625dfa58c68ee7d97e
Author: cooldaemon <cooldaemon at gmail.com>
Date:   Thu Feb 11 21:53:43 2010 +0900

    Fixed an argument for new and connect methods.
---
 lib/AnyEvent/RabbitMQ.pm           | 15 +++++----------
 lib/RabbitFoot.pm                  | 22 +++++++---------------
 lib/RabbitFoot/Cmd/Role/Command.pm |  2 +-
 xt/04_anyevent.t                   |  3 ++-
 xt/05_coro.t                       |  8 +++++---
 xt/06_multi_channel.t              |  7 +++----
 6 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/lib/AnyEvent/RabbitMQ.pm b/lib/AnyEvent/RabbitMQ.pm
index ef303ba..46ee654 100644
--- a/lib/AnyEvent/RabbitMQ.pm
+++ b/lib/AnyEvent/RabbitMQ.pm
@@ -22,12 +22,6 @@ has verbose => (
     is  => 'rw',
 );
 
-has timeout => (
-    isa     => 'Int',
-    is      => 'rw',
-    default => 1,
-);
-
 has _connect_guard => (
     isa     => 'Guard',
     is      => 'ro',
@@ -81,6 +75,8 @@ sub connect {
     my $self = shift;
     my %args = $self->_set_cbs(@_);
 
+    $args{timeout} ||= 0;
+
     if ($self->verbose) {
         print STDERR 'connect to ', $args{host}, ':', $args{port}, '...', "\n";
     }
@@ -103,7 +99,7 @@ sub connect {
             $self->_start(%args,);
         },
         sub {
-            return $self->timeout;
+            return $args{timeout};
         },
     );
 
@@ -500,9 +496,7 @@ AnyEvent::RabbitMQ - An asynchronous and multi channel Perl AMQP client.
 
   my $cv = AnyEvent->condvar;
 
-  my $ar = AnyEvent::RabbitMQ->new(
-      timeout => 1,
-  )->load_xml_spec(
+  my $ar = AnyEvent::RabbitMQ->new->load_xml_spec(
       '/path/to/amqp0-8.xml',
   )->connect(
       host       => 'localhosti',
@@ -510,6 +504,7 @@ AnyEvent::RabbitMQ - An asynchronous and multi channel Perl AMQP client.
       user       => 'guest',
       port       => 'guest',
       vhost      => '/',
+      timeout    => 1,
       on_success => sub {
           $ar->open_channel(
               on_success => sub {
diff --git a/lib/RabbitFoot.pm b/lib/RabbitFoot.pm
index a19800b..35a160c 100644
--- a/lib/RabbitFoot.pm
+++ b/lib/RabbitFoot.pm
@@ -15,12 +15,6 @@ has verbose => (
     is  => 'rw',
 );
 
-has timeout => (
-    isa     => 'Int',
-    is      => 'rw',
-    default => 1,
-);
-
 has _ar => (
     isa     => 'AnyEvent::RabbitMQ',
     is      => 'ro',
@@ -41,7 +35,6 @@ sub BUILD {
     my $self = shift;
     $self->{_ar} = AnyEvent::RabbitMQ->new(
         verbose => $self->verbose,
-        timeout => $self->timeout,
     );
 }
 
@@ -82,16 +75,15 @@ RabbitFoot - An Asynchronous and single channel Perl AMQP client.
 
   use RabbitFoot;
 
-  my $rf = RabbitFoot->new(
-      timeout => 1,
-  )->load_xml_spec(
+  my $rf = RabbitFoot->new()->load_xml_spec(
       '/path/to/amqp0-8.xml',
   )->connect(
-      host  => 'localhosti',
-      port  => 5672,
-      user  => 'guest',
-      port  => 'guest',
-      vhost => '/',
+      host    => 'localhosti',
+      port    => 5672,
+      user    => 'guest',
+      port    => 'guest',
+      vhost   => '/',
+      timeout => 1,
   );
 
   my $ch = $rf->open_channel();
diff --git a/lib/RabbitFoot/Cmd/Role/Command.pm b/lib/RabbitFoot/Cmd/Role/Command.pm
index b01190c..c6ca24a 100644
--- a/lib/RabbitFoot/Cmd/Role/Command.pm
+++ b/lib/RabbitFoot/Cmd/Role/Command.pm
@@ -116,10 +116,10 @@ sub execute {
 
     my $ch = RabbitFoot->new(
         verbose => $self->verbose,
-        timeout => 1,
     )->load_xml_spec(
         $self->spec,
     )->connect(
+        timeout => 5,
         (map {$_ => $self->$_} qw(host port user pass vhost))
     )->open_channel();
 
diff --git a/xt/04_anyevent.t b/xt/04_anyevent.t
index 1765f37..c8c6370 100644
--- a/xt/04_anyevent.t
+++ b/xt/04_anyevent.t
@@ -25,7 +25,7 @@ plan tests => 24;
 
 use AnyEvent::RabbitMQ;
 
-my $ar = AnyEvent::RabbitMQ->new(timeout => 1,);
+my $ar = AnyEvent::RabbitMQ->new();
 
 lives_ok sub {
     $ar->load_xml_spec($FindBin::Bin . '/../fixed_amqp0-8.xml')
@@ -34,6 +34,7 @@ lives_ok sub {
 my $done = AnyEvent->condvar;
 $ar->connect(
     (map {$_ => $conf->{$_}} qw(host port user pass vhost)),
+    timeout    => 1,
     on_success => sub {
         my $ar = shift;
         isa_ok($ar, 'AnyEvent::RabbitMQ');
diff --git a/xt/05_coro.t b/xt/05_coro.t
index 0af244f..9830cd1 100644
--- a/xt/05_coro.t
+++ b/xt/05_coro.t
@@ -26,15 +26,17 @@ plan tests => 23;
 use Coro;
 use RabbitFoot;
 
-#my $rf = RabbitFoot->new(timeout => 1, verbose => 1,);
-my $rf = RabbitFoot->new(timeout => 1,);
+my $rf = RabbitFoot->new();
 
 lives_ok sub {
     $rf->load_xml_spec($FindBin::Bin . '/../fixed_amqp0-8.xml')
 }, 'load xml spec';
  
 lives_ok sub {
-    $rf->connect((map {$_ => $conf->{$_}} qw(host port user pass vhost)));
+    $rf->connect(
+        (map {$_ => $conf->{$_}} qw(host port user pass vhost)),
+        timeout => 1,
+    );
 }, 'connect';
 
 my $ch;
diff --git a/xt/06_multi_channel.t b/xt/06_multi_channel.t
index 5a723fa..d551040 100644
--- a/xt/06_multi_channel.t
+++ b/xt/06_multi_channel.t
@@ -26,12 +26,11 @@ plan tests => 6;
 use Coro;
 use RabbitFoot;
 
-my $rf = RabbitFoot->new(
-    timeout => 1,
-)->load_xml_spec(
+my $rf = RabbitFoot->new()->load_xml_spec(
     $FindBin::Bin . '/../fixed_amqp0-8.xml',
 )->connect(
-    (map {$_ => $conf->{$_}} qw(host port user pass vhost))
+    (map {$_ => $conf->{$_}} qw(host port user pass vhost)),
+    timeout => 1,
 );
 
 my $main = $Coro::current;

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