Imported Upstream version 3.3.2
[debian/amanda] / perl / Amanda / Changer.pm
index ddb7f660a5ef559a2b459892587d57752cdfa508..419c1a0d510755522595522c3e48d288f68d3b1c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2007,2008,2009,2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2007-2012 Zmanda, Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -1253,15 +1253,19 @@ sub make_new_tape_label {
 
     my $tl = $self->{'tapelist'};
     die ("make_new_tape_label: no tapelist") if !$tl;
-    return undef if !defined $self->{'autolabel'}->{'template'};
-    return undef if !defined $self->{'labelstr'};
+    if (!defined $self->{'autolabel'}) {
+       return (undef, "autolabel not set");
+    }
+    if (!defined $self->{'autolabel'}->{'template'}) {
+       return (undef, "template is not set, you must set autolabel");
+    }
+    if (!defined $self->{'labelstr'}) {
+       return (undef, "labelstr not set");
+    }
     my $template = $self->{'autolabel'}->{'template'};
     my $labelstr = $self->{'labelstr'};
     my $slot_digit = 1;
 
-    if (!$template) {
-       return (undef, "template is not set, you must set autolabel");
-    }
     $template =~ s/\$\$/SUBSTITUTE_DOLLAR/g;
     $template =~ s/\$b/SUBSTITUTE_BARCODE/g;
     $template =~ s/\$m/SUBSTITUTE_META/g;