make missing value in marc_fixed confess and fixed warning
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 6 Sep 2007 19:12:15 +0000 (19:12 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 6 Sep 2007 19:12:15 +0000 (19:12 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@889 07558da8-63fa-0310-ba24-9fe276d99e06

lib/WebPAC/Normalize.pm

index a65b144..03ee351 100644 (file)
@@ -535,12 +535,14 @@ sub marc_fixed {
        my ($f, $pos, $val) = @_;
        die "need marc(field, position, value)" unless defined($f) && defined($pos);
 
+       confess "need val" unless defined $val;
+
        my $update = 0;
 
        map {
                if ($_->[0] eq $f) {
                        my $old = $_->[1];
-                       if (length($old) < $pos) {
+                       if (length($old) <= $pos) {
                                $_->[1] .= ' ' x ( $pos - length($old) ) . $val;
                                warn "## marc_fixed($f,$pos,'$val') append '$old' -> '$_->[1]'\n" if ($debug > 1);
                        } else {