Amanda::Interactive -- Parent class for user interactivity modules
use Amanda::Interactive;
my $inter = Amanda::Interactive->new(name => 'stdin', inter_conf => $inter_conf); $inter->user_request( message => "Insert Volume labelled 'MY_LABEL-001'", finished_cb => sub { my ($err, $reply) = @_; if ($err) { # error from the script } elsif (!defined $reply) { # request aborted } else { # use reply } });
This package provides a way for Amanda programs to communicate interactively with the user. The program can send a message to the user and await a textual response. The package operates asynchronously (see Amanda::MainLoop), so the program may continue with other activities while waiting for an answer from the user.
Several interactivity modules are (or soon will be) available, and can be selected by the user.
A new object is create with the new
function as follows:
my $inter = Amanda::Interactive->new( name => $interactive_name, inter_conf => $inter_conf);
Where $interactive_name
is the name of the desired interactivity module
(e.g., 'stdin'
).
$inter->user_request(message => $message, label => $label, err => $err, finished_cb => $finished_cb);
This method return immediately. It sends message
to the user and waits for a
reply. The label
and err
parameters .. well, what do they do? (TODO)
The user_request
method's finished_cb
as parameter is similar to the
callback of the same name in Amanda::Changer. In the even of an error, it
is called with an Amanda::Changer::Error
object as first argument. If the
request is answered, then the second argument is the user's response. If the
request is aborted (see abort
, below), then both arguments are undef
.
$inter->abort()
This method will abort all pending user_request
invocations, invoking their
finished_cb
with (undef, undef)
.
This page was automatically generated Tue Nov 19 20:05:35 2013 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.