1Net::DBus::RemoteServicUes(e3r)Contributed Perl DocumentNaetti:o:nDBus::RemoteService(3)
2
3
4
6 Net::DBus::RemoteService - Access services provided on the bus
7
9 my $bus = Net::DBus->find;
10 my $service = $bus->get_service("org.freedesktop.DBus");
11
12 my $object = $service->get_object("/org/freedesktop/DBus");
13 foreach (@{$object->ListNames}) {
14 print "$_\n";
15 }
16
18 This object provides a handle to a remote service on the bus. From this
19 handle it is possible to access objects associated with the service. If
20 a service is not running, an attempt will be made to activate it the
21 first time a method is called against one of its objects.
22
24 my $service = Net::DBus::RemoteService->new($bus, $owner,
25 $service_name);
26 Creates a new handle for a remote service. The $bus parameter is an
27 instance of Net::DBus, $owner is the name of the client providing
28 the service, while $service_name is the well known name of the
29 service on the bus. Service names consist of two or more tokens,
30 separated by periods, while the tokens comprise the letters a-z,
31 A-Z, 0-9 and _, for example "org.freedesktop.DBus". There is
32 generally no need to call this constructor, instead the
33 "get_service" method on Net::DBus should be used. This caches
34 handles to remote services, eliminating repeated retrieval of
35 introspection data.
36
37 my $bus = $service->get_bus;
38 Retrieves a handle for the bus to which this service is attached.
39 The returned object will be an instance of Net::DBus.
40
41 my $service_name = $service->get_service_name
42 Retrieves the name of the remote service as known to the bus.
43
44 my $owner_name = $service->get_owner_name;
45 Retrieves the name of the client owning the service at the time it
46 was connected to.
47
48 my $object = $service->get_object($object_path[, $interface]); =item my
49 $object = $service->get_object($object_path, \%params);
50 Retrieves a handle to the remote object provided by the service
51 with the name of $object_path. If the optional $interface parameter
52 is provided, the object will immediately be cast to the designated
53 interface. NB, it is only necessary to cast an object to a specific
54 interface if there are multiple interfaces on the object providing
55 methods with the same name, or the remote object does support
56 introspection. The returned object will be an instance of
57 Net::DBus::RemoteObject.
58
59 An alternate form of the method is available, passing a hash
60 reference of extra parameters. Valid keys in the hash are
61 "interface" specifying the interface name to cast to, and "timeout"
62 specifying a timeout in milliseconds
63
64 my $timeout = $service->timeout(60 * 1000);
65 Sets or retrieves the timeout value which will be used for DBus
66 requests belongs to this service. The value is in milliseconds. If
67 the timeout for a service is undefined, then the default timeout
68 from the bus will apply.
69
71 Daniel Berrange <dan@berrange.com>
72
74 Copright (C) 2004-2011, Daniel Berrange.
75
77 Net::DBus::RemoteObject, Net::DBus::Service, Net::DBus
78
79
80
81perl v5.38.0 2023-07-21 Net::DBus::RemoteService(3)