logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Net::DBus::GLib - Perl extension for the DBus GLib bindings

Author

       Daniel Berrange <dan@berrange.com>

Description

       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.

Example

       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!");

Methods

       my $bus = Net::DBus::GLib->find(%params);
           Search  for  the most appropriate bus to connect to and return a connection to it. For details of the
           heuristics used, consult the method of the same name in "Net::DBus".  The %params hash may contain an
           additional entry with a  name  of  "context".  This  can  be  a  reference  to  an  instance  of  the
           "Glib::MainContext" object; if omitted, the default GLib context will be used.

       my $bus = Net::DBus::GLib->system(%params);
           Return a handle for the system message bus. For further details on this method, consult to the method
           of  the  same  name  in  Net::DBus.  The  %params hash may contain an additional entry with a name of
           "context". This can be a reference to an instance of the "Glib::MainContext" object; if omitted,  the
           default GLib context will be used.

       my $bus = Net::DBus::GLib->session(%params);
           Return  a  handle  for  the  session  message bus. For further details on this method, consult to the
           method of the same name in Net::DBus. The %params hash may contain an additional entry with a name of
           "context". This can be a reference to an instance of the "Glib::MainContext" object; if omitted,  the
           default GLib context will be used.

Name

       Net::DBus::GLib - Perl extension for the DBus GLib bindings

See Also

       Net::DBus, Glib, Glib::MainLoop "http://dbus.freedesktop.org", "http://gtk.org"

Synopsis

         ####### 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

See Also