fixed rt#101884

This commit is contained in:
git@daemon.de
2015-02-09 10:20:51 +01:00
parent 4072dcac7a
commit c226659c32
3 changed files with 26 additions and 9 deletions

View File

@@ -1,6 +1,10 @@
0.9
0.10
o fixed RT#101884
- _trim() only removed 1st whitespace
- optional checks were ineffective if the value was undef
0.09
o Added AUTHOR, LICENSE and ABSTRACT fields to Makefile.PL
o Fixed 'Artistic' typo in Makefile.PL
o fixed cached errors bug - if a validator object has

4
README
View File

@@ -434,7 +434,7 @@ SEE ALSO
Data::Validate::IP common data validation methods for IP-addresses.
LICENSE AND COPYRIGHT
Copyright (c) 2007-2014 T. v.Dein
Copyright (c) 2007-2015 T. v.Dein
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
@@ -469,5 +469,5 @@ AUTHORS
Thanks to David Cantrell for his helpful hints.
VERSION
0.08
0.10

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2007-2014 T. v.Dein <tlinden |AT| cpan.org>.
# Copyright (c) 2007-2015 T. v.Dein <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun.
#
@@ -21,7 +21,7 @@ use File::stat;
use Data::Validate qw(:math is_printable);
use Data::Validate::IP qw(is_ipv4 is_ipv6);
our $VERSION = 0.09;
our $VERSION = 0.10;
use vars qw(@ISA);
@@ -251,6 +251,19 @@ sub _check_type {
# the value in $hash->{$key} (shortcut)
my $value = $hash->{$key};
# is the value checkable?
unless (defined $value) {
if (grep { $_ eq 'optional' } @types) {
# do nothing
$self->_debug("$key is optional");
return;
}
else {
# report error
return "value of '$key' is undef";
}
}
# the aggregated match over *all* types
my $match = 0;
foreach my $type (@types) {
@@ -301,7 +314,7 @@ sub _check_type {
sub _trim {
my @a = @_;
foreach (@a) {
s/^\s+|\s+$//;
s/^\s+|\s+$//g;
}
return wantarray ? @a : $a[0];
}
@@ -846,7 +859,7 @@ L<Data::Validate::IP> common data validation methods for IP-addresses.
=head1 LICENSE AND COPYRIGHT
Copyright (c) 2007-2014 T. v.Dein
Copyright (c) 2007-2015 T. v.Dein
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@@ -886,7 +899,7 @@ Thanks to David Cantrell for his helpful hints.
=head1 VERSION
0.09
0.10
=cut