| BBConfig documentation | Contained in the BBConfig distribution. |
BoxBackup::Config::DiskSets - Access to Box Backup diskset config files
use BoxBackup::Config::DiskSets; $diskSets = BoxBackup::Config::DiskSets->new();
or
use BoxBackup::Config::DiskSets;
$file = "/etc/bbox/raidfile.conf";
$diskSets = BoxBackup::Config::DiskSets->new($file);
@diskNames = $diskSets->getListofDisks();
foreach $i (@diskNames)
{
print "Block size of " . $i . " is " . $disksets->getParamVal($i, "BlockSize) . " bytes.\n";
}
BoxBackup::Config::DiskSets is a rather simple package that lets the user have access to the data from the disk set configuration file for Box Backup. It provides methods to retrieve the data only. No creation or editing is supported.
Allows for programmatic access to the information stored in the Box Backup 'disk set' config file, which holds the information related to each disk set in the Box Backup installation.
Per Reedtz Thomsen (mailto:pthomsen@reedtz.com)
| BBConfig documentation | Contained in the BBConfig distribution. |
#!/usr/bin/perl -w package BoxBackup::Config::DiskSets; use strict; use Carp; use Config::Scoped;
our $VERSION = v0.03; sub new { my ($self, @args) = @_; my $disksetFile = $args[0] || "/etc/box/raidfile.conf"; my $parser = Config::Scoped->new( file => $disksetFile ); $self = $parser->parse; return bless $self; } sub getListofDisks { my ($self) = @_; # Return an array of disk names from $self. return keys %$self; } sub getParamVal { my ($self, $disk, $parm) = @_; return 0 if(!defined($disk) || !defined($parm)); return -1 if(!defined($self->{$disk}{$parm})); return $self->{$disk}{$parm}; } 1;