mirror of
https://codeberg.org/scip/Data-Validate-Struct.git
synced 2025-12-17 04:31:01 +01:00
fixed rt#101884
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
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 Added AUTHOR, LICENSE and ABSTRACT fields to Makefile.PL
|
||||||
|
|
||||||
o Fixed 'Artistic' typo in Makefile.PL
|
o Fixed 'Artistic' typo in Makefile.PL
|
||||||
|
|||||||
4
README
4
README
@@ -434,7 +434,7 @@ SEE ALSO
|
|||||||
Data::Validate::IP common data validation methods for IP-addresses.
|
Data::Validate::IP common data validation methods for IP-addresses.
|
||||||
|
|
||||||
LICENSE AND COPYRIGHT
|
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
|
This library is free software; you can redistribute it and/or modify it
|
||||||
under the same terms as Perl itself.
|
under the same terms as Perl itself.
|
||||||
@@ -469,5 +469,5 @@ AUTHORS
|
|||||||
Thanks to David Cantrell for his helpful hints.
|
Thanks to David Cantrell for his helpful hints.
|
||||||
|
|
||||||
VERSION
|
VERSION
|
||||||
0.08
|
0.10
|
||||||
|
|
||||||
|
|||||||
23
Struct.pm
23
Struct.pm
@@ -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.
|
# All Rights Reserved. Std. disclaimer applies.
|
||||||
# Artistic License, same as perl itself. Have fun.
|
# 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 qw(:math is_printable);
|
||||||
use Data::Validate::IP qw(is_ipv4 is_ipv6);
|
use Data::Validate::IP qw(is_ipv4 is_ipv6);
|
||||||
|
|
||||||
our $VERSION = 0.09;
|
our $VERSION = 0.10;
|
||||||
|
|
||||||
use vars qw(@ISA);
|
use vars qw(@ISA);
|
||||||
|
|
||||||
@@ -251,6 +251,19 @@ sub _check_type {
|
|||||||
# the value in $hash->{$key} (shortcut)
|
# the value in $hash->{$key} (shortcut)
|
||||||
my $value = $hash->{$key};
|
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
|
# the aggregated match over *all* types
|
||||||
my $match = 0;
|
my $match = 0;
|
||||||
foreach my $type (@types) {
|
foreach my $type (@types) {
|
||||||
@@ -301,7 +314,7 @@ sub _check_type {
|
|||||||
sub _trim {
|
sub _trim {
|
||||||
my @a = @_;
|
my @a = @_;
|
||||||
foreach (@a) {
|
foreach (@a) {
|
||||||
s/^\s+|\s+$//;
|
s/^\s+|\s+$//g;
|
||||||
}
|
}
|
||||||
return wantarray ? @a : $a[0];
|
return wantarray ? @a : $a[0];
|
||||||
}
|
}
|
||||||
@@ -846,7 +859,7 @@ L<Data::Validate::IP> common data validation methods for IP-addresses.
|
|||||||
|
|
||||||
=head1 LICENSE AND COPYRIGHT
|
=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
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the same terms as Perl itself.
|
modify it under the same terms as Perl itself.
|
||||||
@@ -886,7 +899,7 @@ Thanks to David Cantrell for his helpful hints.
|
|||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
0.09
|
0.10
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user