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.16'; |
4
|
10
|
|
|
10
|
|
1231186
|
use ZMQ::FFI::Util qw(zmq_soname zmq_version); |
|
10
|
|
|
|
|
45
|
|
|
10
|
|
|
|
|
68
|
|
5
|
10
|
|
|
10
|
|
9525
|
use ZMQ::FFI::ErrorHelper; |
|
10
|
|
|
|
|
38
|
|
|
10
|
|
|
|
|
359
|
|
6
|
10
|
|
|
10
|
|
96
|
use Carp; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
2453
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
10
|
|
|
10
|
1
|
4198
|
my $self = shift; |
10
|
10
|
|
|
|
|
31
|
my %args = @_; |
11
|
|
|
|
|
|
|
|
12
|
10
|
|
33
|
|
|
119
|
$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__ |