NAME

Exobrain::Message - Top-level role for all exobrain messages

VERSION

version 1.08

DESCRIPTION

This is the base role upon which upon which all Exobrain messages adhere to.

METHODS

payload

    payload size => ( isa => 'Int' );

Convenience method which sets the 'payload' trait on an attribute, as well as marking it as 'ro' and required by default (these can be overridden).

namespace

    my $namespace = $message->namespace;

Provides the namespace of the message type in question. By default this is the class name with the Exobrain prefix stripped, but individual message classes are free to define their own namespaces.

data

    my $data = $message->data;

Messages automatically create a data method (needed for transmitting over the exobrain bus) by tallying payload attributes.

send_msg($socket?)

Sends the message across the exobrain bus. If no socket is provided, the one from the exobrain object (if we were built with one) is used.

This method is invoked automatically unless the nosend option is used when the message was created.

This generates a warning (and does NOT send the packet) if the _sent flag on the message is set. This flag is set automatically after sending.

dump()

    my $pkt_debug = $msg->dump;

Provides a string containing a dump of universal packet attributes. Intended for debugging.

AUTHOR

Paul Fenwick <pjf@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Paul Fenwick.

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