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 Data::Send::Local;
use Test::More tests=>2;
use Test::SharedFork;

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

if (my $pid = fork())
 {ok recvLocal($socket) eq $data;                                              # Receive data
  waitpid($pid, 0);
 }
else
 {ok !sendLocal($socket, $data);                                               # Send data
 }

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  

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.  

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.