packages: bacula/bacula-backup-mysql - Config class returns arrayref if the...

glen glen at pld-linux.org
Wed May 27 14:53:05 CEST 2009


Author: glen                         Date: Wed May 27 12:53:05 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- Config class returns arrayref if there are multiple items, deref it if array is wanted

---- Files affected:
packages/bacula:
   bacula-backup-mysql (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: packages/bacula/bacula-backup-mysql
diff -u packages/bacula/bacula-backup-mysql:1.3 packages/bacula/bacula-backup-mysql:1.4
--- packages/bacula/bacula-backup-mysql:1.3	Wed May 13 22:46:52 2009
+++ packages/bacula/bacula-backup-mysql	Wed May 27 14:53:00 2009
@@ -45,6 +45,8 @@
 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 @@
 	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 @@
 
 	# 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 @@
 	# 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};
 }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/bacula/bacula-backup-mysql?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list