NanoMsg::Raw::Message - Message buffer for NanoMsg::Raw
use NanoMsg::Raw; { my $msg = nn_allocmsg(3, 0); $msg->copy('foo'); nn_send($sock, $msg); } { nn_recv($sock, my $buf); warn $buf; }
Instances of this class represent a message buffer allocated by nanomsg. New empty buffers can be allocated using nn_allocmsg. Both nn_recv and nn_recvmsg can be used to allocate buffers initialised with the contents of a received message.
nn_allocmsg
nn_recv
nn_recvmsg
NanoMsg::Raw::Messages can be used to send and receive data in a zero-copy fashion.
NanoMsg::Raw::Message
When using a message instance as a string, its overloading will produce a string containing a copy of the buffer content.
A string pointing to the actual buffer content, without having to create a copy of it, can be obtained by dereferencing the message instance as a scalar.
$msg->copy('foo');
Copies $data to the beginning of the buffer. If the data is larger than the space allocated for the buffer, an exception will be thrown.
$data
NanoMsg::Raw
To install NanoMsg::Raw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm NanoMsg::Raw
CPAN shell
perl -MCPAN -e shell install NanoMsg::Raw
For more information on module installation, please visit the detailed CPAN module installation guide.