NAME

IPC::Manager::Spawn - Encapsulation of a newly initiated message store.

DESCRIPTION

This object encapsualtes a newly initialized message store. It also provides methods for acting on the message store.

SYNOPSIS

use IPC::Manager;

my $spawn = ipcm_spawn();

my $con = $spawn->connect('con1');

...

$spawn->shutdown;

METHODS

$con = $spawn->connect($name)

Establish a client connection with the given client name.

$bool = $spawn->guard()

Check if this instance is a guard. If it is then $spawn->shutdown will be called when the object falls out of scope.

$info = $spawn->info()

Get the JSON string with connection information.

$pid = $spawn->pid()

Get the PID the spawn object was created it.

$protocol = $spawn->protocol()

Get the protocol of the IPC system.

$route = $spawn->route()

Get the route information for the IPC system.

$spawn->sanity_check()
$spawn->sanity_check($con)

Should only be used once the IPC system is no longer in use. Used to verify all messages that were sent were also recieved.

Will throw an exception if there is a difference between messages sent and recieved.

%delta = $spawn->sanity_delta()

Get a list of message mismatches. This is used by sanity_check(), but can also be used independently if you want to avoid exceptions.

$serializer = $spawn->serializer()

Get the serializer used by the IPC system.

$spawn->shutdown()

Shuws down the IPC system:

my $con = $spawn->connect('spawn');

$spawn->terminate($con);
$spawn->wait($con);
$spawn->sanity_check($con);

$con->disconnect;
$con = undef;

$spawn->unspawn;
$sig = $spawn->signal()

Get the signal that will be sent to all processes when terminate is called.

Default in undef, which means no signal is sent.

$stash = $spawn->stash()

Get the stash the protocol provided when it spawned a new store.

$spawn->terminate()
$spawn->terminate($con)

Terminate the IPC system. This will send a termination message to all clients, and will send signals to all their processes if a signal is set.

$spawn->unspawn()

Teardown/destroy the IPC data store. This usually means deleting a directory or temporary database.

$spawn->wait()
$spawn->wait($con)

Wait for all clients to disconnect.

SOURCE

The source code repository for IPC::Manager can be found at https://https://github.com/exodist/IPC-Manager.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See https://dev.perl.org/licenses/