[libmessage-passing-zeromq-perl] 46/78: Fixed for new version

Jonas Smedegaard js at alioth.debian.org
Mon Sep 30 09:28:25 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libmessage-passing-zeromq-perl.

commit 6455bef981bd946daa0080dd2bd410cff47837df
Author: Tomas Doran <bobtfish at bobtfish.net>
Date:   Fri Jun 8 07:40:48 2012 +0100

    Fixed for new version
---
 Makefile.PL                          |    2 +-
 lib/Message/Passing/Input/ZeroMQ.pm  |    4 +---
 lib/Message/Passing/Output/ZeroMQ.pm |    3 +--
 t/input.t                            |    4 +++-
 t/output.t                           |   12 +++++++-----
 t/pushpull.t                         |    9 ++++++---
 6 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 72b6221..c830825 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -21,7 +21,7 @@ requires 'JSON';
 requires 'JSON::XS';
 requires 'Try::Tiny';
 requires 'Task::Weaken';
-requires 'Message::Passing' => '0.002';
+requires 'Message::Passing' => '0.006';
 requires 'POSIX::AtFork' => '0.02';
 requires 'Sub::Name';
 
diff --git a/lib/Message/Passing/Input/ZeroMQ.pm b/lib/Message/Passing/Input/ZeroMQ.pm
index 957d6fc..efb4e51 100644
--- a/lib/Message/Passing/Input/ZeroMQ.pm
+++ b/lib/Message/Passing/Input/ZeroMQ.pm
@@ -29,9 +29,7 @@ sub _try_rx {
     my $self = shift();
     my $msg = $self->_zmq_recv(ZMQ_NOBLOCK);
     if ($msg) {
-        my $data = try { $self->decode($msg->data) }
-            catch { warn $_ };
-        $self->output_to->consume($data);
+        $self->output_to->consume($msg->data);
     }
     return $msg;
 }
diff --git a/lib/Message/Passing/Output/ZeroMQ.pm b/lib/Message/Passing/Output/ZeroMQ.pm
index 9b44dff..286d428 100644
--- a/lib/Message/Passing/Output/ZeroMQ.pm
+++ b/lib/Message/Passing/Output/ZeroMQ.pm
@@ -21,8 +21,7 @@ after setsockopt => sub {
 sub consume {
     my $self = shift;
     my $data = shift;
-    my $bytes = $self->encode($data);
-    $self->_zmq_send($bytes);
+    $self->_zmq_send($data);
 }
 
 with 'Message::Passing::Role::Output';
diff --git a/t/input.t b/t/input.t
index 928b153..8d5fefc 100644
--- a/t/input.t
+++ b/t/input.t
@@ -4,6 +4,7 @@ use Test::More;
 
 use AnyEvent;
 use Message::Passing::Input::ZeroMQ;
+use Message::Passing::Filter::Decoder::JSON;
 use Message::Passing::Output::Test;
 use ZeroMQ qw/:all/;
 
@@ -11,9 +12,10 @@ my $cv = AnyEvent->condvar;
 my $output = Message::Passing::Output::Test->new(
     cb => sub { $cv->send },
 );
+my $dec = Message::Passing::Filter::Decoder::JSON->new(output_to => $output);
 my $input = Message::Passing::Input::ZeroMQ->new(
     socket_bind => 'tcp://*:5558',
-    output_to => $output,
+    output_to => $dec,
 );
 ok $input;
 
diff --git a/t/output.t b/t/output.t
index 15fc986..e736b87 100644
--- a/t/output.t
+++ b/t/output.t
@@ -3,6 +3,7 @@ use warnings;
 use Test::More;
 
 use AnyEvent;
+use JSON qw/ encode_json /;
 use Message::Passing::Input::ZeroMQ;
 use Message::Passing::Output::Test;
 use Message::Passing::Output::ZeroMQ;
@@ -11,21 +12,22 @@ my $output = Message::Passing::Output::ZeroMQ->new(
     connect => 'tcp://127.0.0.1:5558',
 );
 
-$output->consume({foo => 'bar'});
+$output->consume(encode_json {foo => 'bar'});
 
 use Message::Passing::Input::ZeroMQ;
 use Message::Passing::Output::Test;
+use Message::Passing::Filter::Decoder::JSON;
 my $cv = AnyEvent->condvar;
 my $input = Message::Passing::Input::ZeroMQ->new(
     socket_bind => 'tcp://*:5558',
-    output_to => Message::Passing::Output::Test->new(
+    output_to => Message::Passing::Filter::Decoder::JSON->new(output_to => Message::Passing::Output::Test->new(
         cb => sub { $cv->send }
-    ),
+    )),
 );
 $cv->recv;
 
-is $input->output_to->message_count, 1;
-is_deeply([$input->output_to->messages], [{foo => 'bar'}]);
+is $input->output_to->output_to->message_count, 1;
+is_deeply([$input->output_to->output_to->messages], [{foo => 'bar'}]);
 
 done_testing;
 
diff --git a/t/pushpull.t b/t/pushpull.t
index c47e741..3faac98 100644
--- a/t/pushpull.t
+++ b/t/pushpull.t
@@ -6,18 +6,21 @@ use Test::More;
 use Message::Passing::Input::ZeroMQ;
 use Message::Passing::Output::ZeroMQ;
 use Message::Passing::Output::Test;
+use Message::Passing::Filter::Encoder::JSON;
+use Message::Passing::Filter::Decoder::JSON;
 my $test = Message::Passing::Output::Test->new;
 my $input = Message::Passing::Input::ZeroMQ->new(
         connect => 'tcp://127.0.0.1:5558',
         socket_type => 'PULL',
-        output_to => $test,
+        output_to => Message::Passing::Filter::Decoder::JSON->new(output_to => $test),
 );
 
-my $output = Message::Passing::Output::ZeroMQ->new(
+my $output = Message::Passing::Filter::Encoder::JSON->new(output_to => Message::Passing::Output::ZeroMQ->new(
     socket_bind => 'tcp://127.0.0.1:5558',
     socket_type => 'PUSH',
-);
+));
 my $cv = AnyEvent->condvar;
+
 my $t; $t = AnyEvent->timer(
     after => 1,
     cb => sub {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmessage-passing-zeromq-perl.git



More information about the Pkg-perl-cvs-commits mailing list