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 or the value of the corresponding member of Protocol::DBus::Message::Header::FIELD().

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.

  • UNIX_FDs are normally represented as Perl filehandle objects. If a UNIX_FD is received that doesn’t correspond to a received file descriptor, the value is represented as the number passed in the D-Bus message, and a warning is thrown.

  • By default, variant signatures are discarded, and the values are given by themselves. See Protocol::DBus::Peer’s preserve_variant_signatures() if you need the signatures.

  • Other 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 themselves have no methods defined (and aren’t even defined Perl namespaces).

MAPPING PERL TO D-BUS

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

  • Use plain Perl filehandle objects to represent UNIX_FDs.

  • 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. (Note the inconsistency with the reverse mapping.)

Examples

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

  • a(s) - ( \@ss )

  • a{ss} - ( \%ss )