3.1.3

Amanda::Tapelist


NAME

Amanda::Tapelist - manipulate the Amanda tapelist


SYNOPSIS

    use Amanda::Tapelist;
    my $tl = Amanda::Tapelist::read_tapelist("/path/to/tapefile");
    $tl->add_tapelabel($datestamp, $label);
    $tl->add_tapelabel($datestamp2, $label2, $comment);
    $tl->write("/path/to/tapefile");


OBJECT-ORIENTED INTERFACE

The package-level functions read_tapelist($filename) and clear_tapelist() both return a new tapelist object. read_tapelist returns undef if the tapelist does not exist. Invalid entries are silently ignored.

A tapelist object is a sequence of tapelist elements (referred to as TLEs in this document), sorted by datestamp from newest to oldest. Each TLE is a hash with the following keys:

position

the one-based position of the TLE in the tapelist

datestamp

the datestamp on which this was written, or "0" for an unused tape

reuse

true if this tape can be reused when it is no longer active

label

tape label

comment

the comment for this tape, or undef if no comment was given

The following methods are available on a tapelist object $tl:

lookup_tapelabel($lbl)

look up and return a reference to the TLE with the given label

lookup_tapepos($pos)

look up and return a reference to the TLE in the given position

lookup_tapedate($date)

look up and return a reference to the TLE with the given datestamp

remove_tapelabel($lbl)

remove the tape with the given label

add_tapelabel($date, $lbl, $comment)

add a tape with the given date, label, and comment to the end of the tapelist, marking it reusable.

write($filename)

write the tapelist out to $filename.


INTERACTION WITH C CODE

The C portions of Amanda treat the tapelist as a global variable, while this package treats it as an object (and can thus handle more than one tapelist simultaneously). Every call to read_tapelist fills this global variable with a copy of the tapelist, and likewise clear_tapelist clears the global. However, any changes made from Perl are not reflected in the C copy, nor are changes made by C modules reflected in the Perl copy.


ABOUT THIS PAGE

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.


3.1.3