/usr/lib/x86_64-linux-gnu/perl5/5.22/ZeroMQ/Context.pm is in libzeromq-perl 0.23-1build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | package ZeroMQ::Context;
use strict;
use ZeroMQ::Raw ();
sub new {
my ($class, $nthreads) = @_;
if (! defined $nthreads || $nthreads <= 0) {
$nthreads = 1;
}
bless {
_ctxt => ZeroMQ::Raw::zmq_init($nthreads),
}, $class;
}
sub ctxt {
$_[0]->{_ctxt};
}
sub socket {
return ZeroMQ::Socket->new(@_); # $_[0] should contain the context
}
sub term {
my $self = shift;
ZeroMQ::Raw::zmq_term($self->ctxt);
}
1;
__END__
=head1 NAME
ZeroMQ::Context - A 0MQ Context object
=head1 SYNOPSIS
use ZeroMQ qw/:all/;
my $cxt = ZeroMQ::Context->new;
my $sock = ZeroMQ::Socket->new($cxt, ZMQ_REP);
=head1 DESCRIPTION
Before opening any 0MQ Sockets, the caller must initialise
a 0MQ context.
=head1 METHODS
=head2 new($nthreads)
Creates a new C<ZeroMQ::Context>.
Optional arguments: The number of io threads to use. Defaults to 1.
=head2 term()
Terminates the current context. You *RARELY* need to call this yourself,
so don't do it unless you know what you're doing.
=head2 socket($type)
Short hand for ZeroMQ::Socket::new.
=head2 ctxt
Return the underlying ZeroMQ::Raw::Context object
=head1 CAVEATS
While in principle, C<ZeroMQ::Context> objects are thread-safe,
they are currently not cloned when a new Perl ithread is spawned.
The variables in the new thread that contained the context in
the parent thread will be a scalar reference to C<undef>
in the new thread. This could be fixed with better control
over the destructor calls.
=head1 SEE ALSO
L<ZeroMQ>, L<ZeroMQ::Socket>
L<http://zeromq.org>
L<ExtUtils::XSpp>, L<Module::Build::WithXSpp>
=head1 AUTHOR
Daisuke Maki E<lt>daisuke@endeworks.jpE<gt>
Steffen Mueller, E<lt>smueller@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
The ZeroMQ module is
Copyright (C) 2010 by Daisuke Maki
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.0 or,
at your option, any later version of Perl 5 you may have available.
=cut
|