Amanda::Interactivity modules list
Amanda modules list
List of All Modules
All Amanda Releases



Amanda::Interactivity -- Parent class for user interactivity modules


    use Amanda::Interactivity;
    my $inter = Amanda::Interactivity->new(name => 'stdin');
        message => "Insert Volume labelled 'MY_LABEL-001' in changer DLT",
        label => 'MY_LABEL-001',
        new_volume => 0,
        chg_name => 'DLT',
        err => "Not found in the library",
        request_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 interactivityly 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::Interactivity->new(
        name => $interactivity_name);

Where $interactivity_name is the name of the desired interactivity defined in the config file.



  $inter->user_request(message     => $message,
                       label       => $label,
                       new_volume  => 0|1,
                       err         => $err,
                       chg_name    => $chg_name,
                       request_cb  => $request_cb);

This method return immediately. It sends a message to the user and waits for a reply. err is the reason why the volume is needed. message is a sentence describing the requested volume. The volume can be describe with many parameters: label is the requested label or the most prefered label. new_volume if a new volume is acceptable. chg_name the name of the changer where amanda expect the volume.

A module can print only message or build something prettier with the values of the other parameters.

The request_cb callback take one or two arguments. 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 first argument is undef and the second argument is the user's response. If the request is aborted (see abort, below), then both arguments are undef.



This method will abort all pending user_request invocations, invoking their request_cb with (undef, undef).


This page was automatically generated Tue Feb 21 19:14:01 2012 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.