r263 - in packages/libdata-formvalidator-perl/trunk: . debian lib/Data lib/Data/FormValidator lib/Data/FormValidator/Constraints t
Gunnar Wolf
gwolf@haydn.debian.org
Fri, 09 Jul 2004 10:38:03 -0600
Author: gwolf
Date: 2004-07-09 10:38:00 -0600 (Fri, 09 Jul 2004)
New Revision: 263
Modified:
packages/libdata-formvalidator-perl/trunk/Changes
packages/libdata-formvalidator-perl/trunk/META.yml
packages/libdata-formvalidator-perl/trunk/Makefile.PL
packages/libdata-formvalidator-perl/trunk/debian/changelog
packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator.pm
packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Constraints/Dates.pm
packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Results.pm
packages/libdata-formvalidator-perl/trunk/t/03_dependency.t
packages/libdata-formvalidator-perl/trunk/t/17_multi_valued_keys.t
packages/libdata-formvalidator-perl/trunk/t/23_dates.t
Log:
New upstream version (3.59)
Modified: packages/libdata-formvalidator-perl/trunk/Changes
===================================================================
--- packages/libdata-formvalidator-perl/trunk/Changes 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/Changes 2004-07-09 16:38:00 UTC (rev 263)
@@ -1,11 +1,16 @@
+3.59 Thu Jul 02 2004
+ [ENHANCEMENTS]
+ - Added more tests for Date constraints, and removed some more warnings (Michael Dorman)
+ [BUG FIXES]
+ - Fixed failing dependency check happening sometimes with a CGI object as input. (Drew Taylor)
+
3.58 Wed May 05 2004
[ENHANCEMENTS]
- Test suite has been migrated further to 'Test::More' style, and
all tests should complete without any warnings. A big thanks
goes to Gabor Szabo for this work.
-
3.57 Wed Apr 21 2004
[ENHANCEMENTS]
- 'validator_packages' now handles the importing of filters as well as constraints.
Modified: packages/libdata-formvalidator-perl/trunk/META.yml
===================================================================
--- packages/libdata-formvalidator-perl/trunk/META.yml 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/META.yml 2004-07-09 16:38:00 UTC (rev 263)
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Data-FormValidator
-version: 3.58
+version: 3.59
license: perl
distribution_type: module
requires:
@@ -16,7 +16,7 @@
provides:
Data::FormValidator:
file: lib/Data/FormValidator.pm
- version: 3.58
+ version: 3.59
Data::FormValidator::Constraints:
file: lib/Data/FormValidator/Constraints.pm
version: 3.5
@@ -34,5 +34,5 @@
version: 3.50
Data::FormValidator::Results:
file: lib/Data/FormValidator/Results.pm
- version: 3.58
+ version: 3.59
generated_by: Module::Build version 0.21
Modified: packages/libdata-formvalidator-perl/trunk/Makefile.PL
===================================================================
--- packages/libdata-formvalidator-perl/trunk/Makefile.PL 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/Makefile.PL 2004-07-09 16:38:00 UTC (rev 263)
@@ -4,7 +4,7 @@
WriteMakefile
(
NAME => 'Data::FormValidator',
- VERSION => '3.58',
+ VERSION => '3.59',
PL_FILES => {},
INSTALLDIRS => 'site',
PREREQ_PM => {
Modified: packages/libdata-formvalidator-perl/trunk/debian/changelog
===================================================================
--- packages/libdata-formvalidator-perl/trunk/debian/changelog 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/debian/changelog 2004-07-09 16:38:00 UTC (rev 263)
@@ -1,3 +1,9 @@
+libdata-formvalidator-perl (3.59-1) unstable; urgency=low
+
+ * (NOT RELEASED YET) New upstream release
+
+ -- Gunnar Wolf <gwolf@gwolf.cx> Fri, 9 Jul 2004 11:36:50 -0500
+
libdata-formvalidator-perl (3.58-1) unstable; urgency=low
* Package maintainership transfered to the Debian Perl Group.
Modified: packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Constraints/Dates.pm
===================================================================
--- packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Constraints/Dates.pm 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Constraints/Dates.pm 2004-07-09 16:38:00 UTC (rev 263)
@@ -67,11 +67,15 @@
my ($i, @order) = 0;
$format =~ s{([YMDhms]+|pp)(\?)?}{
- $order[$i++] = substr($1,0,1);
- if ($1 eq 'pp') {
+ my ($chr,$q) = ($1,$2);
+ $chr = '' if not defined $chr;
+ $q = '' if not defined $chr;
+
+ $order[$i++] = substr($chr,0,1);
+ if ($chr eq 'pp') {
"(AM|PM|am|pm)"
} else {
- '(' . ('\d' x length($1)) . ($2 ? $2 : "") . ")"
+ '(' . ('\d' x length($chr)) . ($q ? $q : "") . ")"
}
}ge;
@@ -91,8 +95,10 @@
$result{$format->[1]->[$i]} ||= $data[$i];
}
- $result{h} += 12 if ($result{p} eq 'PM' and $result{h} != 12);
- $result{h} = 0 if ($result{p} eq 'AM' and $result{h} == 12);
+ if (exists $result{p}) {
+ $result{h} += 12 if ($result{p} eq 'PM' and $result{h} != 12);
+ $result{h} = 0 if ($result{p} eq 'AM' and $result{h} == 12);
+ }
return $untainted_date, map {defined $result{$_} ? $result{$_} : 0} qw(Y M D h m s);
@@ -102,7 +108,6 @@
1;
__END__
-# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Modified: packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Results.pm
===================================================================
--- packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Results.pm 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator/Results.pm 2004-07-09 16:38:00 UTC (rev 263)
@@ -20,7 +20,7 @@
use Data::FormValidator::Constraints (qw/:validators :matchers/);
use vars qw/$AUTOLOAD $VERSION/;
-$VERSION = 3.58;
+$VERSION = 3.59;
=pod
@@ -212,7 +212,17 @@
if ($valid{$field}) {
if (ref($deps) eq 'HASH') {
foreach my $key (keys %$deps) {
- if($valid{$field} eq $key){
+ # Handle case of a key with a single value given as an arrayref
+ # There is probably a better, more general soution to this problem.
+ my $val_to_compare;
+ if ((ref $valid{$field} eq 'ARRAY') and (scalar @{ $valid{$field} } == 1)) {
+ $val_to_compare = $valid{$field}->[0];
+ }
+ else {
+ $val_to_compare = $valid{$field}
+ }
+
+ if($val_to_compare eq $key){
foreach my $dep (_arrayify($deps->{$key})){
$required{$dep} = 1;
}
Modified: packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator.pm
===================================================================
--- packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator.pm 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/lib/Data/FormValidator.pm 2004-07-09 16:38:00 UTC (rev 263)
@@ -31,7 +31,7 @@
use vars qw( $VERSION $AUTOLOAD @ISA @EXPORT_OK %EXPORT_TAGS );
-$VERSION = '3.58';
+$VERSION = '3.59';
require Exporter;
@ISA = qw(Exporter);
Modified: packages/libdata-formvalidator-perl/trunk/t/03_dependency.t
===================================================================
--- packages/libdata-formvalidator-perl/trunk/t/03_dependency.t 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/t/03_dependency.t 2004-07-09 16:38:00 UTC (rev 263)
@@ -3,7 +3,7 @@
$^W = 1;
-use Test::More tests => 6;
+use Test::More tests => 7;
use Data::FormValidator;
@@ -47,4 +47,15 @@
ok($missings{'cc_num'});
ok(not $missings{'cc_exp'});
+## Now, some tests using a CGI.pm object as input
+use CGI;
+my $q = CGI->new('cc_type=Visa');
+my $results;
+eval {
+ $results = $validator->check($input_hashref,'default');
+};
+ok($results->missing('cc_num'), 'using CGI.pm object for input');
+
+
+
Modified: packages/libdata-formvalidator-perl/trunk/t/17_multi_valued_keys.t
===================================================================
--- packages/libdata-formvalidator-perl/trunk/t/17_multi_valued_keys.t 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/t/17_multi_valued_keys.t 2004-07-09 16:38:00 UTC (rev 263)
@@ -1,10 +1,10 @@
-# This script tests validating keyts with multiple data
+# This script tests validating keys with multiple data
use strict;
use lib ('.','../t');
$^W = 1;
-use Test::More tests => 7;
+use Test::More tests => 8;
my $input_hash = {
single_value => ' Just One ',
@@ -69,3 +69,25 @@
ok(!$v, 'multiple valued fields containing only undefined values should not be valid');
+###
+
+use Data::Dumper;
+
+eval { $r = Data::FormValidator->check({
+ cc_type => ['Check'],
+ },
+ {
+ required => 'cc_type',
+ dependencies => {
+ cc_type => {
+ Check => [qw( cc_num )],
+ Visa => [qw( cc_num cc_exp cc_name )],
+ },
+ },
+ }) };
+diag "error: $@" if $@;
+
+ok($r->missing('cc_num'), 'a single valued array should still trigger the dependency check')
+ || diag Dumper($r);
+
+;
Modified: packages/libdata-formvalidator-perl/trunk/t/23_dates.t
===================================================================
--- packages/libdata-formvalidator-perl/trunk/t/23_dates.t 2004-07-09 16:36:08 UTC (rev 262)
+++ packages/libdata-formvalidator-perl/trunk/t/23_dates.t 2004-07-09 16:38:00 UTC (rev 263)
@@ -1,4 +1,5 @@
-use Test::More tests => 11;
+#!/usr/bin/perl -w
+use Test::More qw/no_plan/;
BEGIN { use_ok('Data::FormValidator::Constraints::Dates') };
use strict;
@@ -13,6 +14,17 @@
ok ($min == 1);
ok ($sec == 3);
+# Now try again, leaving out PM, which may trigger a warning when it shouldn't
+$format = Data::FormValidator::Constraints::Dates::_prepare_date_format('MM/DD/YYYY hh?:mm:ss');
+($date,$year, $month, $day, $hour, $min, $sec) = Data::FormValidator::Constraints::Dates::_parse_date_format($format, '12/02/2003 1:01:03');
+is($date,'12/02/2003 1:01:03','returning untainted date');
+ok ($year == 2003, 'basic date prepare and parse test');
+ok ($month == 12, 'month');
+ok ($day == 2,'day');
+ok ($hour == 1,'hour');
+ok ($min == 1,'min');
+ok ($sec == 3,'sec');
+
use Data::FormValidator;
my $simple_profile = {