Revision 9c49e265
Von Steven Schubiger vor mehr als 2 Jahren hinzugefügt
SL/Helper/QrBill.pm | ||
---|---|---|
75 | 75 |
|
76 | 76 |
my $check_re = sub { |
77 | 77 |
my ($group, $href, $elem, $regex) = @_; |
78 |
defined $href->{$elem} && $href->{$elem} =~ $regex |
|
79 |
or die "field '$elem' in group '$group' not valid", "\n"; |
|
78 |
my $error = undef; |
|
79 |
if (!exists $href->{$elem}) { |
|
80 |
$error = 'does not exist'; |
|
81 |
} elsif (!defined $href->{$elem}) { |
|
82 |
$error = 'is not defined'; |
|
83 |
} elsif ($href->{$elem} !~ $regex) { |
|
84 |
$error = 'is not valid'; |
|
85 |
} |
|
86 |
die "field '$elem' in group '$group' $error", "\n" if defined $error; |
|
80 | 87 |
}; |
81 | 88 |
|
82 | 89 |
my $group = 'biller information'; |
Auch abrufbar als: Unified diff
Swiss QR-Bill: QrBill.pm: Verbessere $check_re()