man-pages/man3/Net::DBus::RemoteObject.3pm.html
2021-03-31 01:06:50 +01:00

171 lines
5.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Net::DBus::RemoteObject</TITLE>
</HEAD><BODY>
<H1>Net::DBus::RemoteObject</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-12-26<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Net::DBus::RemoteObject - Access objects provided on the bus
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
my $service = $bus-&gt;get_service(&quot;org.freedesktop.DBus&quot;);
my $object = $service-&gt;get_object(&quot;/org/freedesktop/DBus&quot;);
print &quot;Names on the bus {\n&quot;;
foreach my $name (sort @{$object-&gt;ListNames}) {
print &quot; &quot;, $name, &quot;\n&quot;;
}
print &quot;}\n&quot;;
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
This module provides the <FONT SIZE="-1">API</FONT> for accessing remote objects available
on the bus. It uses the autoloader to fake the presence of methods
based on the <FONT SIZE="-1">API</FONT> of the remote object. There is also support for
setting callbacks against signals, and accessing properties of the
object.
<A NAME="lbAE">&nbsp;</A>
<H2>METHODS</H2>
<DL COMPACT>
<DT id="1">my $object = Net::DBus::RemoteObject-&gt;new($service, $object_path[, $interface], \%params);<DD>
Creates a new handle to a remote object. The <TT>$service</TT> parameter is an instance
of the Net::DBus::RemoteService method, and <TT>$object_path</TT> is the identifier of
an object exported by this service, for example <TT>&quot;/org/freedesktop/DBus&quot;</TT>. For remote
objects which implement more than one interface it is possible to specify an optional
name of an interface as the third parameter. This is only really required, however, if
two interfaces in the object provide methods with the same name, since introspection
data can be used to automatically resolve the correct interface to call cases where
method names are unique. Rather than using this constructor directly, it is preferable
to use the <TT>&quot;get_object&quot;</TT> method on Net::DBus::RemoteService, since this caches handles
to remote objects, eliminating unnecessary introspection data lookups.
<P>
The <TT>%params</TT> parameter contains extra configuration parameters for the object. Currently
a single parameter is supported, <TT>&quot;timeout&quot;</TT> which takes a value in milliseconds to use as
the timeout for method calls on the object.
<DT id="2">my $object = $object-&gt;as_interface($interface);<DD>
Casts the object to a specific interface, returning a new instance of the
Net::DBus::RemoteObject specialized to the desired interface. It is only
necessary to cast objects to a specific interface, if two interfaces
export methods or signals with the same name, or the remote object does not
support introspection.
<DT id="3">my $service = $object-&gt;get_service<DD>
Retrieves a handle for the remote service on which this object is
attached. The returned object is an instance of Net::DBus::RemoteService
<DT id="4">my $path = $object-&gt;get_object_path<DD>
Retrieves the unique path identifier for this object within the
service.
<DT id="5">my $object = $object-&gt;get_child_object($subpath, [$interface])<DD>
Retrieves a handle to a child of this object, identified
by the relative path <TT>$subpath</TT>. The returned object
is an instance of <TT>&quot;Net::DBus::RemoteObject&quot;</TT>. The optional
<TT>$interface</TT> parameter can be used to immediately cast
the object to a specific type.
<DT id="6">my $sigid = $object-&gt;connect_to_signal($name, $coderef);<DD>
Connects a callback to a signal emitted by the object. The <TT>$name</TT>
parameter is the name of the signal within the object, and <TT>$coderef</TT>
is a reference to an anonymous subroutine. When the signal <TT>$name</TT>
is emitted by the remote object, the subroutine <TT>$coderef</TT> will be
invoked, and passed the parameters from the signal. A unique <TT>$sigid</TT>
will be returned, which can be later passed to <TT>&quot;disconnect_from_signal&quot;</TT>
to remove the handler
<DT id="7">$object-&gt;disconnect_from_signal($name, $sigid);<DD>
Disconnects from a signal emitted by the object. The <TT>$name</TT>
parameter is the name of the signal within the object. The
<TT>$sigid</TT> must be the unique signal handler <FONT SIZE="-1">ID</FONT> returned by
a previous <TT>&quot;connect_to_signal&quot;</TT> method call.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>AUTHOR</H2>
Daniel Berrange &lt;<A HREF="mailto:dan@berrange.com">dan@berrange.com</A>&gt;
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copright (C) 2004-2011, Daniel Berrange.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
Net::DBus::RemoteService, Net::DBus::Object, Net::DBus::Annotation
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="8"><A HREF="#lbAB">NAME</A><DD>
<DT id="9"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="10"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="11"><A HREF="#lbAE">METHODS</A><DD>
<DT id="12"><A HREF="#lbAF">AUTHOR</A><DD>
<DT id="13"><A HREF="#lbAG">COPYRIGHT</A><DD>
<DT id="14"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:49 GMT, March 31, 2021
</BODY>
</HTML>