The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Protocol::DBus::Message

DESCRIPTION

This class encapsulates a single DBus message. You generally should not instantiate it directly.

METHODS

OBJ->get_header( $NAME )

$NAME is, e.g., PATH.

OBJ->get_body()

Always returned as an array reference or undef. See below about mapping between D-Bus and Perl.

OBJ->get_type()

Returns a number. Cross-reference with the D-Bus specification.

OBJ->type_is( $NAME )

Convenience method; $NAME is, e.g., METHOD_CALL.

OBJ->get_flags()

Returns a number. Cross-reference with the D-Bus specification.

OBJ->flags_have( @NAME )

Convenience method; indicates whether all of the given @NAMES (e.g., NO_AUTO_START) correspond to flags that are set in the message.

OBJ->get_serial()

Returns a number.

MAPPING D-BUS TO PERL

  • Numeric and string types are represented as plain Perl scalars.

  • Containers are represented as blessed references: Protocol::DBus::Type::Dict, Protocol::DBus::Type::Array, and Protocol::DBus::Type::Struct. Currently these are just plain hash and array references that are bless()ed; i.e., the classes don’t have any methods defined.

  • Variant signatures are not preserved; the values are represented according to the above logic.

MAPPING PERL TO D-BUS

  • Use plain Perl scalars to represent all numeric and string types.

  • Use array references to represent D-Bus arrays and structs. Use hash references for dicts.

  • Use a two-member array reference—signature then value—to represent a D-Bus variant.

Examples

  • s(s) - ( $s0, [ $s1 ] )

  • a(s) - ( \@ss )

  • a{ss} - ( \%ss )