1Net::DBus::GLib(3) User Contributed Perl Documentation Net::DBus::GLib(3)
2
3
4
6 Net::DBus::GLib - Perl extension for the DBus GLib bindings
7
9 ####### Attaching to the bus ###########
10
11 use Net::DBus::GLib;
12
13 # Find the most appropriate bus
14 my $bus = Net::DBus::GLib->find;
15
16 # ... or explicitly go for the session bus
17 my $bus = Net::DBus::GLib->session;
18
19 # .... or explicitly go for the system bus
20 my $bus = Net::DBus::GLib->system
21
23 Net::DBus::GLib provides an extension to the Net::DBus module allowing
24 integration with the GLib mainloop. To integrate with the main loop,
25 simply get a connection to the bus via the methods in Net::DBus::GLib
26 rather than the usual Net::DBus module. That's it - every other API
27 remains the same.
28
30 As an example service using the GLib main loop, assuming that
31 SomeObject inherits from Net::DBus::Service
32
33 my $bus = Net::DBus::GLib->session();
34 my $service = $bus->export_service("org.designfu.SampleService");
35 my $object = SomeObject->new($service);
36
37 Glib::MainLoop->new()->run();
38
39 And as an example client
40
41 my $bus = Net::DBus::GLib->session();
42
43 my $service = $bus->get_service("org.designfu.SampleService");
44 my $object = $service->get_object("/SomeObject");
45
46 my $list = $object->HelloWorld("Hello from example-client.pl!");
47
49 my $bus = Net::DBus::GLib->find(%params);
50 Search for the most appropriate bus to connect to and return a
51 connection to it. For details of the heuristics used, consult the
52 method of the same name in "Net::DBus". The %params hash may
53 contain an additional entry with a name of "context". This can be a
54 reference to an instance of the "Glib::MainContext" object; if
55 omitted, the default GLib context will be used.
56
57 my $bus = Net::DBus::GLib->system(%params);
58 Return a handle for the system message bus. For further details on
59 this method, consult to the method of the same name in Net::DBus.
60 The %params hash may contain an additional entry with a name of
61 "context". This can be a reference to an instance of the
62 "Glib::MainContext" object; if omitted, the default GLib context
63 will be used.
64
65 my $bus = Net::DBus::GLib->session(%params);
66 Return a handle for the session message bus. For further details on
67 this method, consult to the method of the same name in Net::DBus.
68 The %params hash may contain an additional entry with a name of
69 "context". This can be a reference to an instance of the
70 "Glib::MainContext" object; if omitted, the default GLib context
71 will be used.
72
74 Net::DBus, Glib, Glib::MainLoop "http://dbus.freedesktop.org",
75 "http://gtk.org"
76
78 Daniel Berrange <dan@berrange.com>
79
81 Copyright 2006-2008 by Daniel Berrange
82
83
84
85perl v5.38.0 2023-07-21 Net::DBus::GLib(3)