Amanda::Tapelist - manipulate the Amanda tapelist
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");
Stable
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). 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.
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.
This page was automatically generated Fri Feb 5 19:41:21 2010 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.