From: Elan Ruusamäe Date: Wed, 27 May 2009 12:53:00 +0000 (+0000) Subject: - Config class returns arrayref if there are multiple items, deref it if array is... X-Git-Tag: auto/ac/bacula-backup-mysql-0_2-1~6 X-Git-Url: https://git.pld-linux.org/gitweb.cgi?p=packages%2Fbacula-backup-mysql.git;a=commitdiff_plain;h=62f7c87593e62731635a33d833da3a014149abda - Config class returns arrayref if there are multiple items, deref it if array is wanted Changed files: bacula-backup-mysql -> 1.4 --- diff --git a/bacula-backup-mysql b/bacula-backup-mysql index d6c6c5d..46e5ea3 100644 --- a/bacula-backup-mysql +++ b/bacula-backup-mysql @@ -45,6 +45,8 @@ for my $cluster ($c->get('clusters', 'cluster')) { sub mysqlhotcopy { my ($cluster, $database, $user, $password, $socket) = @_; + print ">>>> mysqlhotcopy $database\n"; + my $dstdir = tempdir("bbm.XXXXXX", DIR => $tmpdir); # make backup with mysqlhotcopy @@ -70,6 +72,8 @@ sub mysqlhotcopy { rename($srcdir, $dirname) or die "Rename '$srcdir'->'$dirname' failed: $!\n"; rmdir($dstdir) or warn $!; + + print "<<<< mysqlhotcopy $database\n"; } sub backup_cluster { @@ -86,6 +90,7 @@ sub backup_cluster { # start with include list my %dbs = map { $_ => 1 } @include; + if (@exclude or !@include) { my $dbh = new BBM::DB($user, $password, $socket); my $sth = $dbh->prepare("show databases"); @@ -147,5 +152,9 @@ sub get { # pay attention if callee wanted arrays return wantarray ? () : undef unless exists $h->{$section}; return wantarray ? () : undef unless exists $h->{$section}->{$key}; + + # deref if wanted array and is arrayref + return @{$h->{$section}->{$key}} if wantarray && ref $h->{$section}->{$key} eq 'ARRAY'; + return $h->{$section}->{$key}; }