1Net::DBus::Callback(3)User Contributed Perl DocumentationNet::DBus::Callback(3)
2
3
4

NAME

6       Net::DBus::Callback - a callback for receiving reactor events
7

SYNOPSIS

9         use Net::DBus::Callback;
10
11         # Assume we have a 'terminal' object and its got a method
12         # to be invoked every time there is input on its terminal.
13         #
14         # To create a callback to invoke this method one might use
15         my $cb = Net::DBus::Callback->new(object => $terminal,
16                                           method => "handle_stdio");
17
18
19         # Whatever is monitoring the stdio channel, would then
20         # invoke the callback, perhaps passing in a parameter with
21         # some 'interesting' data, such as number of bytes available
22         $cb->invoke($nbytes)
23
24         #... which results in a call to
25         #  $terminal->handle_stdio($nbytes)
26

DESCRIPTION

28       This module provides a simple container for storing details about a
29       callback to be invoked at a later date. It is used when registering to
30       receive events from the Net::DBus::Reactor class. NB use of this module
31       in application code is no longer necessary and it remains purely for
32       backwards compatibility.  Instead you can simply pass a subroutine code
33       reference in any place where a callback is desired.
34

METHODS

36       my $cb = Net::DBus::Callback->new(method => $name, [args => \@args])
37           Creates a new callback object, for invoking a plain old function.
38           The "method" parameter should be the fully qualified function name
39           to invoke, including the package name. The optional "args"
40           parameter is an array reference of parameters to be pass to the
41           callback, in addition to those passed into the "invoke" method.
42
43       my $cb = Net::DBus::Callback->new(object => $object, method => $name,
44       [args => \@args])
45           Creates a new callback object, for invoking a method on an object.
46           The "method" parameter should be the name of the method to invoke,
47           while the "object" parameter should be a blessed object on which
48           the method will be invoked. The optional "args" parameter is an
49           array reference of parameters to be pass to the callback, in
50           addition to those passed into the "invoke" method.
51
52       $cb->invoke(@args)
53           Invokes the callback. The argument list passed to the callback is a
54           combination of the arguments supplied in the callback constructor,
55           followed by the arguments supplied in the "invoke" method.
56

AUTHOR

58       Daniel P. Berrange.
59
61       Copyright (C) 2004-2011 Daniel P. Berrange
62

SEE ALSO

64       Net::DBus::Reactor
65
66
67
68perl v5.32.0                      2020-07-28            Net::DBus::Callback(3)
Impressum