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

NAME

Protocol::DBus::Client::EventBase - Base class for event-driven Protocol::DBus

DESCRIPTION

This base class encapsulates the fundamentals of an event-loop-aware Protocol::DBus::Client. If you use D-Bus in a standard event loop (i.e., an event loop from CPAN), you probably want to use a subclass of this module.

The module you’ll actually use will be an end class like Protocol::DBus::Client::IOAsync or Protocol::DBus::Client::AnyEvent.

SUBCLASS INTERFACE

Currently the subclass interface is not documented for public consumption. Contact me if you’d like to change that (and are willing to put in some effort toward such end).

TODO

There aren’t tests written against this module or its subclasses. It would be great to rectify that.

INSTANCE METHODS

$promise = OBJ->initialize()

Returns a promise that resolves to a Protocol::DBus::Client::EventMessenger instance. That object, not this one, is what you’ll use to send and receive messages.

$obj = OBJ->on_signal( $HANDLER_CR )

Installs a handler for D-Bus signals. Whenever OBJ receives such a message, an instance of Protocol::DBus::Message that represents the message will be passed to $HANDLER_CR.

Pass undef to disable a previously-set handler.

Returns OBJ.

$obj = OBJ->on_message( $HANDLER_CR )

Like on_signal() but for all received D-Bus messages, not just signals. This is useful for monitoring … and not much else?

$obj = OBJ->on_failure( $HANDLER_CR )

Set this to receive a copy of whatever error kills the connection. If not set, such an error will be warn()ed.