Net::DBus::GLib(3pm)
π NAME π
Net::DBus::GLib β it's the Perl extension for the DBus GLib bindings, bestie. That's the whole name, that's the whole vibe β¨
πΈ SYNOPSIS πΈ
okay so first things first, you gotta attach to the bus. here's the trio of ways:
####### 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
periodt π
π¦ DESCRIPTION π¦
So Net::DBus::GLib is literally an extension to the Net::DBus module that lets you integrate with the GLib mainloop. That's it, that's the whole thing π«Ά
And the way you do it? Instead of grabbing your bus connection the usual Net::DBus way, you just grab it through the methods in Net::DBus::GLib. Done. Every other API stays exactly the same β no cap, no extra steps, no surprises. iconic behavior honestly π
π EXAMPLE π
Wanna see it in the wild? Here's a lil example service using the GLib main loop β and for this to work we're 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 here's the client side, because of course you need both halves of the convo π¬
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!");
π METHODS π
π my $bus = Net::DBus::GLib->find(%params);
Goes off looking for the most appropriate bus to connect to and hands you back a connection to it. Wanna know the deets on the heuristics it uses? Go read the method of the same name over in "Net::DBus" β that's where the lore lives π
The %params hash can also carry an extra entry named "context". That one can be a reference to an instance of the Glib::MainContext object. And if you just... don't include it? No worries bestie, the default GLib context gets used instead π
π my $bus = Net::DBus::GLib->system(%params);
Returns you a handle for the system message bus. Want the full rundown on this method? Consult the method of the same name in Net::DBus.
And yep β %params can also hold that extra entry named "context", which can be a reference to an instance of the Glib::MainContext object. Omit it and the default GLib context is what you get π
π my $bus = Net::DBus::GLib->session(%params);
Returns you a handle for the session message bus this time. For further details on this method, consult the method of the same name in Net::DBus.
Same deal as the others: %params may contain an additional entry named "context", and it can be a reference to an instance of the Glib::MainContext object. If it's omitted, the default GLib context gets used π
π SEE ALSO π
Net::DBusGlibGlib::MainLoop"http://dbus.freedesktop.org""http://gtk.org"
iykyk, go read those too π
β¨ AUTHOR β¨
Daniel Berrange <dan@berrange.com> β king behavior, we stan π
π«Ά COPYRIGHT π«Ά
Copyright 2006-2008 by Daniel Berrange
and that's the whole page, bestie π this was Net::DBus::GLib(3pm) from the User Contributed Perl Documentation, and the footer energy is: perl v5.42.3, dated 2026-08-20. slay, go build something cute πΈπ¦
π¦ where this page comes from
- ubuntu stonking: libnet-dbus-glib-perl 0.33.0-4build6 Β· GPL-2.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms