Data::Tools::Socket provides set of socket I/O functions.
use Data::Tools::Socket qw( :all ); # import all functions use Data::Tools::Socket; # the same as :all :) use Data::Tools::Socket qw( :none ); # do not import anything, use full package names # -------------------------------------------------------------------------- my $read_res_len = socket_read( $socket, $data_ref, $length, $timeout ); my $write_res_len = socket_write( $socket, $data, $length, $timeout ); my $write_res_len = socket_print( $socket, $data, $timeout ); # -------------------------------------------------------------------------- my $read_data = socket_read_message( $socket, $timeout ); my $write_res = socket_write_message( $socket, $data, $timeout ); # --------------------------------------------------------------------------
Reads $length sized data from the $socket and store it to $data_ref scalar reference.
Returns read length (can be shorter than requested $length);
$timeout is optional, it is in seconds and can be less than 1 second.
Writes $length sized data from $data scalar to the $socket.
Returns write length (can be shorter than requested $length);
Same as socket_write() but calculates requested length from the $data scalar.
Reads 32bit network-order integer, which then is used as data size to be read from the socket (i.e. message = 32bit-integer + data ).
Returns read data or undef for message or network error.
Writes 32bit network-order integer, which is the size of the given $data to be written to the $socket and then writes the data (i.e. message = 32bit-integer + data ).
Returns 1 on success or undef for message or network error.
* more docs
Data::Tools::Socket uses:
* IO::Select * Time::HiRes
git@github.com:cade-vs/perl-data-tools.git git clone git://github.com/cade-vs/perl-data-tools.git
Vladi Belperchinov-Shabanski "Cade" <cade@noxrun.com> <cade@bis.bg> <cade@cpan.org> http://cade.noxrun.com/
To install Data::Tools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Tools
CPAN shell
perl -MCPAN -e shell install Data::Tools
For more information on module installation, please visit the detailed CPAN module installation guide.