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

132 lines
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Net::DBus::Callback</TITLE>
</HEAD><BODY>
<H1>Net::DBus::Callback</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::Callback - a callback for receiving reactor events
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use Net::DBus::Callback;
# Assume we have a 'terminal' object and its got a method
# to be invoked every time there is input on its terminal.
#
# To create a callback to invoke this method one might use
my $cb = Net::DBus::Callback-&gt;new(object =&gt; $terminal,
method =&gt; &quot;handle_stdio&quot;);
# Whatever is monitoring the stdio channel, would then
# invoke the callback, perhaps passing in a parameter with
# some 'interesting' data, such as number of bytes available
$cb-&gt;invoke($nbytes)
#... which results in a call to
# $terminal-&gt;handle_stdio($nbytes)
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
This module provides a simple container for storing details
about a callback to be invoked at a later date. It is used
when registering to receive events from the Net::DBus::Reactor
class. <FONT SIZE="-1">NB</FONT> use of this module in application code is no longer
necessary and it remains purely for backwards compatibility.
Instead you can simply pass a subroutine code reference in
any place where a callback is desired.
<A NAME="lbAE">&nbsp;</A>
<H2>METHODS</H2>
<DL COMPACT>
<DT id="1">my $cb = Net::DBus::Callback-&gt;new(method =&gt; $name, [args =&gt; \@args])<DD>
Creates a new callback object, for invoking a plain old function. The <TT>&quot;method&quot;</TT>
parameter should be the fully qualified function name to invoke, including the
package name. The optional <TT>&quot;args&quot;</TT> parameter is an array reference of parameters
to be pass to the callback, in addition to those passed into the <TT>&quot;invoke&quot;</TT> method.
<DT id="2">my $cb = Net::DBus::Callback-&gt;new(object =&gt; $object, method =&gt; $name, [args =&gt; \@args])<DD>
Creates a new callback object, for invoking a method on an object. The <TT>&quot;method&quot;</TT>
parameter should be the name of the method to invoke, while the <TT>&quot;object&quot;</TT> parameter
should be a blessed object on which the method will be invoked. The optional <TT>&quot;args&quot;</TT>
parameter is an array reference of parameters to be pass to the callback, in addition
to those passed into the <TT>&quot;invoke&quot;</TT> method.
<DT id="3">$cb-&gt;invoke(@args)<DD>
Invokes the callback. The argument list passed to the callback
is a combination of the arguments supplied in the callback
constructor, followed by the arguments supplied in the <TT>&quot;invoke&quot;</TT>
method.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>AUTHOR</H2>
Daniel P. Berrange.
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (C) 2004-2011 Daniel P. Berrange
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
Net::DBus::Reactor
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">METHODS</A><DD>
<DT id="8"><A HREF="#lbAF">AUTHOR</A><DD>
<DT id="9"><A HREF="#lbAG">COPYRIGHT</A><DD>
<DT id="10"><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>