The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Data::Send::Local - Send and receive a block of data between processes on the local machine.

Synopsis

Send hello between two processes running on the same machine over the socket named socket.

  use Test2::Bundle::More;

  my $socket = 'socket';                                                        # Socket name
  my $data   = 'hello';                                                         # Data

  if (fork())
   {ok Data::Send::Local::recvLocal($socket) eq $data;                          # Receive data
   }
  else
   {ok !Data::Send::Local::sendLocal($socket, $data);                           # Send data without error
   }

  done_testing;

Description

The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.

Send and receive

sendLocal($$$)

Send a block of data locally. Returns undef on success otherwise an error message

  1  $socketName  Socket name (a socket file name that already exists)
  2  $data        Data
  3  $timeOut     Optional timeout for socket to be created - defaults to 10 seconds

This is a static method and so should be invoked as:

  Data::Send::Local::sendLocal

recvLocal($$)

Receive a block of data sent locally. Returns the data received.

  1  $socketName  Socket name (a socket file name that is created)
  2  $length      Optional maximum length to receive - defaults to one megabyte.

This is a static method and so should be invoked as:

  Data::Send::Local::recvLocal

Index

1 recvLocal

2 sendLocal

Installation

This module is written in 100% Pure Perl and, thus, it is easy to read, use, modify and install.

Standard Module::Build process for building and installing modules:

  perl Build.PL
  ./Build
  ./Build test
  ./Build install

Author

philiprbrenan@gmail.com

http://www.appaapps.com

Copyright

Copyright (c) 2016-2017 Philip R Brenan.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.