69 |
|
|
70 |
foreach my $l (split(/[\n\r]+/, $v_file)) { |
foreach my $l (split(/[\n\r]+/, $v_file)) { |
71 |
$curr_line++; |
$curr_line++; |
72 |
# skip comments |
|
73 |
next if ($l =~ m/^#/); |
# skip comments and whitespaces |
74 |
|
next if ($l =~ /^#/ || $l =~ /^\s*$/); |
75 |
|
|
76 |
$l =~ s/^\s+//; |
$l =~ s/^\s+//; |
77 |
$l =~ s/\s+$//; |
$l =~ s/\s+$//; |
78 |
|
|
79 |
my @d = split(/\s+/, $l); |
my @d = split(/\s+/, $l); |
80 |
|
|
81 |
my $fld = shift @d || $log->logdie("need field name in line $curr_line: $l"); |
my $fld = shift @d; |
82 |
|
|
83 |
|
$log->logdie("need field name in line $curr_line: $l") unless (defined($fld)); |
84 |
|
|
85 |
if (@d) { |
if (@d) { |
86 |
$v->{$fld} = \@d; |
$v->{$fld} = \@d; |
94 |
|
|
95 |
$self->{rules} = $v; |
$self->{rules} = $v; |
96 |
|
|
97 |
|
$log->info("validation uses rules from $self->{path}"); |
98 |
|
|
99 |
$self ? return $self : return undef; |
$self ? return $self : return undef; |
100 |
} |
} |
101 |
|
|
123 |
|
|
124 |
foreach my $f (keys %{ $rec }) { |
foreach my $f (keys %{ $rec }) { |
125 |
|
|
126 |
next if (!defined($f) || $f eq ''); |
next if (!defined($f) || $f eq '' || $f eq '000'); |
127 |
|
|
128 |
if (! defined($r->{$f})) { |
if (! defined($r->{$f})) { |
129 |
push @errors, "field '$f' shouldn't exists"; |
push @errors, "field '$f' shouldn't exists"; |