line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ZMQ::FFI; |
2
|
|
|
|
|
|
|
# ABSTRACT: zeromq bindings using libffi and FFI::Raw |
3
|
|
|
|
|
|
|
$ZMQ::FFI::VERSION = '0.18'; |
4
|
14
|
|
|
14
|
|
433961
|
use ZMQ::FFI::Util qw(zmq_soname zmq_version); |
|
14
|
|
|
|
|
45
|
|
|
14
|
|
|
|
|
102
|
|
5
|
14
|
|
|
14
|
|
12825
|
use ZMQ::FFI::ErrorHelper; |
|
14
|
|
|
|
|
63
|
|
|
14
|
|
|
|
|
564
|
|
6
|
14
|
|
|
14
|
|
135
|
use Carp; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
3326
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
14
|
|
|
14
|
1
|
12446
|
my $self = shift; |
10
|
14
|
|
|
|
|
107
|
my %args = @_; |
11
|
|
|
|
|
|
|
|
12
|
14
|
|
33
|
|
|
409
|
$args{soname} //= zmq_soname( die => 1 ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# explicitly passing in a loaded error helper instance |
15
|
|
|
|
|
|
|
# (i.e. zmq error bindings) guards against the OS X loader clobbering errno, |
16
|
|
|
|
|
|
|
# which can happen if the bindings are loaded lazily |
17
|
0
|
|
|
|
|
|
$args{error_helper} = |
18
|
|
|
|
|
|
|
ZMQ::FFI::ErrorHelper->new( soname => $args{soname} ); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my ($major) = zmq_version($args{soname}); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if ($major == 2) { |
23
|
0
|
|
|
|
|
|
require ZMQ::FFI::ZMQ2::Context; |
24
|
0
|
|
|
|
|
|
return ZMQ::FFI::ZMQ2::Context->new(%args); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
0
|
|
|
|
|
|
require ZMQ::FFI::ZMQ3::Context; |
28
|
0
|
|
|
|
|
|
return ZMQ::FFI::ZMQ3::Context->new(%args); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |