[libmessage-passing-zeromq-perl] 22/78: Add initial support for push and pull sockets
Jonas Smedegaard
js at alioth.debian.org
Mon Sep 30 09:28:20 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 33abd27327ba0c27cd1237e14bff270bd87b9c03
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Sat Mar 17 18:17:02 2012 +0000
Add initial support for push and pull sockets
---
README | 2 +-
lib/Log/Stash/Input/ZeroMQ.pm | 2 +-
lib/Log/Stash/Output/ZeroMQ.pm | 2 +-
lib/Log/Stash/ZeroMQ/Role/HasASocket.pm | 10 +++++++++-
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/README b/README
index 4b7bb75..c4eca7c 100644
--- a/README
+++ b/README
@@ -59,7 +59,7 @@ SPONSORSHIP
This module exists due to the wonderful people at Suretec Systems Ltd.
<http://www.suretecsystems.com/> who sponsored it's development for its
VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with
- the SureVoIP API -
+ the SureVoIP API -
<http://www.surevoip.co.uk/support/wiki/api_documentation>
COPYRIGHT
diff --git a/lib/Log/Stash/Input/ZeroMQ.pm b/lib/Log/Stash/Input/ZeroMQ.pm
index 960f4d3..85c7b72 100644
--- a/lib/Log/Stash/Input/ZeroMQ.pm
+++ b/lib/Log/Stash/Input/ZeroMQ.pm
@@ -23,7 +23,7 @@ has socket_bind => (
default => 'tcp://*:5558',
);
-sub _socket_type { ZMQ_SUB }
+sub _socket_type { 'SUB' }
around _build_socket => sub {
my ($orig, $self, @args) = @_;
diff --git a/lib/Log/Stash/Output/ZeroMQ.pm b/lib/Log/Stash/Output/ZeroMQ.pm
index 7fe52fc..50e5d78 100644
--- a/lib/Log/Stash/Output/ZeroMQ.pm
+++ b/lib/Log/Stash/Output/ZeroMQ.pm
@@ -17,7 +17,7 @@ has connect => (
default => sub { 'tcp://127.0.0.1:5558' },
);
-sub _socket_type { ZMQ_PUB }
+sub _socket_type { 'PUB' }
around _build_socket => sub {
my ($orig, $self, @args) = @_;
diff --git a/lib/Log/Stash/ZeroMQ/Role/HasASocket.pm b/lib/Log/Stash/ZeroMQ/Role/HasASocket.pm
index 5513f36..a41ef1b 100644
--- a/lib/Log/Stash/ZeroMQ/Role/HasASocket.pm
+++ b/lib/Log/Stash/ZeroMQ/Role/HasASocket.pm
@@ -1,6 +1,7 @@
package Log::Stash::ZeroMQ::Role::HasASocket;
use Moose::Role;
use ZeroMQ ':all';
+use Moose::Util::TypeConstraints;
use namespace::autoclean;
with 'Log::Stash::ZeroMQ::Role::HasAContext';
@@ -33,13 +34,20 @@ has linger => (
sub _build_socket {
my $self = shift;
- my $socket = $self->_ctx->socket($self->_socket_type);
+ my $type_name = "ZeroMQ::Constants::ZMQ_" . $self->socket_type;
+ my $socket = $self->_ctx->socket(do { no strict 'refs'; &$type_name() });
if (!$self->linger) {
$socket->setsockopt(ZMQ_LINGER, 0);
}
$socket;
}
+has socket_type => (
+ isa => enum([qw[PUB SUB PUSH PULL]]),
+ is => 'ro',
+ builder => '_socket_type',
+);
+
1;
=head1 NAME
--
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