NAME
IPC::Manager::Message - Messages sent between clients.
DESCRIPTION
This encapsulates messages sent between clients.
SYNOPSIS
use IPC::Manager::Message;
my $msg = IPC::Manager::Message->new(
from => 'con1', # No default, required
to => 'con2', # No default, required unless broadcast is true
broadcast => 0, # Default 0
stamp => Time::HiRes::time(), # Default to now
id => gen_uuid(), # Default: new uuid
content => {hello => 'world'}, # No default, required
);
Most of the time you will be using the send_message() interface to produce these:
$from_client->send_message($to_client => $content);
METHODS
- $client_name = $msg->from
-
Get the name of the 'from' client.
- $client_name = $msg->to
-
Get the name of the 'to' client. May be undefined on broadcast messages.
- $bool = $msg->broadcast
-
True if the message is/was intended for broadcast.
- $stamp = $msg->stamp
-
Timestamp of the message.
- $string = $msg->id
-
Message ID. If none was provided a new UUID is used.
- $content = $msg->content
-
Message content. Should be a hashref or arrayref.
- $bool = $msg->is_terminate
-
True if this is a termination message as sent when an IPC::Manager::Spawn is cleaning up an instance.
- $content = $msg->TO_JSON
-
Used to turn the message into a raw hashref for JSON serialization.
- $copy = $msg->clone(%overrides)
-
Create a copy of the message with a new ID, and any overrides specified.
SOURCE
The source code repository for IPC::Manager can be found at https://https://github.com/exodist/IPC-Manager.
MAINTAINERS
AUTHORS
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.