Net::DBus::GLib(3pm) | User Contributed Perl Documentation | Net::DBus::GLib(3pm) |
Net::DBus::GLib - Perl extension for the DBus GLib bindings
####### Attaching to the bus ########### use Net::DBus::GLib; # Find the most appropriate bus my $bus = Net::DBus::GLib->find; # ... or explicitly go for the session bus my $bus = Net::DBus::GLib->session; # .... or explicitly go for the system bus my $bus = Net::DBus::GLib->system
Net::DBus::GLib provides an extension to the Net::DBus module allowing integration with the GLib mainloop. To integrate with the main loop, simply get a connection to the bus via the methods in Net::DBus::GLib rather than the usual Net::DBus module. That's it - every other API remains the same.
As an example service using the GLib main loop, assuming that SomeObject inherits from Net::DBus::Service
my $bus = Net::DBus::GLib->session(); my $service = $bus->export_service("org.designfu.SampleService"); my $object = SomeObject->new($service); Glib::MainLoop->new()->run();
And as an example client
my $bus = Net::DBus::GLib->session(); my $service = $bus->get_service("org.designfu.SampleService"); my $object = $service->get_object("/SomeObject"); my $list = $object->HelloWorld("Hello from example-client.pl!");
Net::DBus, Glib, Glib::MainLoop "http://dbus.freedesktop.org", "http://gtk.org"
Daniel Berrange <dan@berrange.com>
Copyright 2006-2008 by Daniel Berrange
2022-10-20 | perl v5.36.0 |