The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Pots::Message - Perl ObjectThreads message class

SYNOPSIS

    use Pots::Message;

    my $msg = Pots::Message->new();
    $msg->type('MyMessage');
    $msg->set('key1', $data1);

    my $msg = Pots::Message->new(
        'MyMessage',
        {
            'key1' => $data1,
        }
    );

DESCRIPTION

This class allows you to store arbitrary data in an object and is very similar in purpose to a standard Perl hash. It is the base element for data exchange between threads along with Pots::MessageQueue.

METHODS

new ([$type] [, {'key' => $value, ...}])

This method creates a new message object. You can optionaly set message content (message type and message data).

type ($type)

Sets message type (arbitrary string) so that you can later filter messages.

set ('key', $value)

Add arbitrary data to the message, identified by 'key'.

get ('key')

Retrieves data stored in the message, identified by 'key'.

AUTHOR and COPYRIGHT

Remy Chibois <rchibois at free.fr>

Copyright (c) 2004 Remy Chibois. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.