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.17'; |
4
|
14
|
|
|
14
|
|
286565
|
use ZMQ::FFI::Util qw(zmq_soname zmq_version); |
|
14
|
|
|
|
|
42
|
|
|
14
|
|
|
|
|
91
|
|
5
|
14
|
|
|
14
|
|
8901
|
use ZMQ::FFI::ErrorHelper; |
|
14
|
|
|
|
|
45
|
|
|
14
|
|
|
|
|
478
|
|
6
|
14
|
|
|
14
|
|
102
|
use Carp; |
|
14
|
|
|
|
|
17
|
|
|
14
|
|
|
|
|
2561
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
14
|
|
|
14
|
1
|
7352
|
my $self = shift; |
10
|
14
|
|
|
|
|
66
|
my %args = @_; |
11
|
|
|
|
|
|
|
|
12
|
14
|
|
33
|
|
|
276
|
$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__ |