1Net::DBus::RemoteObjectU(s3e)r Contributed Perl DocumentaNteito:n:DBus::RemoteObject(3)
2
3
4
6 Net::DBus::RemoteObject - Access objects provided on the bus
7
9 my $service = $bus->get_service("org.freedesktop.DBus");
10 my $object = $service->get_object("/org/freedesktop/DBus");
11
12 print "Names on the bus {\n";
13 foreach my $name (sort @{$object->ListNames}) {
14 print " ", $name, "\n";
15 }
16 print "}\n";
17
19 This module provides the API for accessing remote objects available on
20 the bus. It uses the autoloader to fake the presence of methods based
21 on the API of the remote object. There is also support for setting
22 callbacks against signals, and accessing properties of the object.
23
25 my $object = Net::DBus::RemoteObject->new($service, $object_path[,
26 $interface], \%params);
27 Creates a new handle to a remote object. The $service parameter is
28 an instance of the Net::DBus::RemoteService method, and
29 $object_path is the identifier of an object exported by this
30 service, for example "/org/freedesktop/DBus". For remote objects
31 which implement more than one interface it is possible to specify
32 an optional name of an interface as the third parameter. This is
33 only really required, however, if two interfaces in the object
34 provide methods with the same name, since introspection data can be
35 used to automatically resolve the correct interface to call cases
36 where method names are unique. Rather than using this constructor
37 directly, it is preferable to use the "get_object" method on
38 Net::DBus::RemoteService, since this caches handles to remote
39 objects, eliminating unnecessary introspection data lookups.
40
41 The %params parameter contains extra configuration parameters for
42 the object. Currently a single parameter is supported, "timeout"
43 which takes a value in milliseconds to use as the timeout for
44 method calls on the object.
45
46 my $object = $object->as_interface($interface);
47 Casts the object to a specific interface, returning a new instance
48 of the Net::DBus::RemoteObject specialized to the desired
49 interface. It is only necessary to cast objects to a specific
50 interface, if two interfaces export methods or signals with the
51 same name, or the remote object does not support introspection.
52
53 my $service = $object->get_service
54 Retrieves a handle for the remote service on which this object is
55 attached. The returned object is an instance of
56 Net::DBus::RemoteService
57
58 my $path = $object->get_object_path
59 Retrieves the unique path identifier for this object within the
60 service.
61
62 my $object = $object->get_child_object($subpath, [$interface])
63 Retrieves a handle to a child of this object, identified by the
64 relative path $subpath. The returned object is an instance of
65 "Net::DBus::RemoteObject". The optional $interface parameter can be
66 used to immediately cast the object to a specific type.
67
68 my $sigid = $object->connect_to_signal($name, $coderef);
69 Connects a callback to a signal emitted by the object. The $name
70 parameter is the name of the signal within the object, and $coderef
71 is a reference to an anonymous subroutine. When the signal $name is
72 emitted by the remote object, the subroutine $coderef will be
73 invoked, and passed the parameters from the signal. A unique $sigid
74 will be returned, which can be later passed to
75 "disconnect_from_signal" to remove the handler
76
77 $object->disconnect_from_signal($name, $sigid);
78 Disconnects from a signal emitted by the object. The $name
79 parameter is the name of the signal within the object. The $sigid
80 must be the unique signal handler ID returned by a previous
81 "connect_to_signal" method call.
82
84 Daniel Berrange <dan@berrange.com>
85
87 Copright (C) 2004-2011, Daniel Berrange.
88
90 Net::DBus::RemoteService, Net::DBus::Object, Net::DBus::Annotation
91
92
93
94perl v5.36.0 2023-01-20 Net::DBus::RemoteObject(3)