Dave Cross: Still Munging Data With Perl: Online event - Mar 17 Learn more

NAME

Protocol::DBus::Client::Mojo - D-Bus with Mojolicious

SYNOPSIS

use experimental 'signatures';
my $dbus = Protocol::DBus::Client::Mojo::system();
$dbus->initialize_p()->then(
sub ($msgr) {
my $a = $msgr->send_call_p( .. )->then( sub ($resp) {
# ..
} );
my $b = $msgr->send_call_p( .. )->then( sub ($resp) {
# ..
} );
return Mojo::Promise->all( $a, $b );
},
)->wait();

DESCRIPTION

This module provides an interface between Mojo::IOLoop and Protocol::DBus::Client. It subclasses Protocol::DBus::Client::EventBase.

Mojolicious-based applications can use this module to interface easily with D-Bus.

INTERFACE NOTES

This module exposes mostly the same interface as Protocol::DBus::Client::AnyEvent, except for a bit of “Mojo-specific” behavior:

  • Returned promises, both from initialize() and the messenger object’s send_call(), are instances of Mojo::Promise rather than Promise::ES6.

  • initialize_p() and send_call_p() exist as aliases for initialize() and send_call(), respectively.

INTERFACE

This module’s interface is identical to that of Protocol::DBus::Client::AnyEvent. See that module for more details.