r21920 - in /trunk/libdata-formvalidator-perl: ./ debian/ lib/Data/ lib/Data/FormValidator/ lib/Data/FormValidator/Constraints/ t/

rmayorga-guest at users.alioth.debian.org rmayorga-guest at users.alioth.debian.org
Fri Jun 20 03:43:55 UTC 2008


Author: rmayorga-guest
Date: Fri Jun 20 03:43:55 2008
New Revision: 21920

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=21920
Log:
* New upstream release
* debian/rules 
  + refresh with dh-make-perl
  + don't install README file
* debian/control
  + move libmodule-build-perl from B-D-I to B-D
  + set standards-version to 3.8.0 (no changes)
  + Add ${perl:Depends}, ${misc:Depends}
    and remove 'perl' and 'perl-modules' from Depends field
  + add libemail-valid-perl to B-D-I and Depends field
  + add myself to uploaders
* debian/copyright - convert to new format
* debian/watch - set to version 3; change the regexp

Added:
    trunk/libdata-formvalidator-perl/t/dependency_coderef.t
      - copied unchanged from r21919, branches/upstream/libdata-formvalidator-perl/current/t/dependency_coderef.t
    trunk/libdata-formvalidator-perl/t/upload_mime_types.t
      - copied unchanged from r21919, branches/upstream/libdata-formvalidator-perl/current/t/upload_mime_types.t
Removed:
    trunk/libdata-formvalidator-perl/Makefile.PL
Modified:
    trunk/libdata-formvalidator-perl/Build.PL
    trunk/libdata-formvalidator-perl/Changes
    trunk/libdata-formvalidator-perl/MANIFEST
    trunk/libdata-formvalidator-perl/MANIFEST.SKIP
    trunk/libdata-formvalidator-perl/META.yml
    trunk/libdata-formvalidator-perl/README
    trunk/libdata-formvalidator-perl/debian/changelog
    trunk/libdata-formvalidator-perl/debian/control
    trunk/libdata-formvalidator-perl/debian/copyright
    trunk/libdata-formvalidator-perl/debian/rules
    trunk/libdata-formvalidator-perl/debian/watch
    trunk/libdata-formvalidator-perl/lib/Data/FormValidator.pm
    trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints.pm
    trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Dates.pm
    trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Upload.pm
    trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Filters.pm
    trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Results.pm
    trunk/libdata-formvalidator-perl/t/FV_length.t
    trunk/libdata-formvalidator-perl/t/dates_closure.t
    trunk/libdata-formvalidator-perl/t/procedural_valid.t

Modified: trunk/libdata-formvalidator-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/Build.PL?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/Build.PL (original)
+++ trunk/libdata-formvalidator-perl/Build.PL Fri Jun 20 03:43:55 2008
@@ -49,6 +49,7 @@
         'overload'        => 0,
         'Perl6::Junction' => 1.10, 
         'Scalar::Util'    => 0,
+        'Email::Valid'    => 0,
 	},
 )->create_build_script;
 

Modified: trunk/libdata-formvalidator-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/Changes?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/Changes (original)
+++ trunk/libdata-formvalidator-perl/Changes Fri Jun 20 03:43:55 2008
@@ -1,3 +1,32 @@
+4.61 Mon Jun 16 14:37:31 EDT 2008
+
+    [INTERNALS]
+    - packaging issue from Perl 4.60 resolved.
+
+4.60 Mon Jun 16 14:10:14 EDT 2008
+
+    [NEW FEATURES]
+    - Dependencies can now be specified using a code ref.
+      Thanks to Bradley C Bailey, via RT#24935.
+
+    [BUG FIXES]
+    - length constraints for min, max and 'between' now work for lengths
+       of 32k and longer. (Carl Vincent). 
+    - We now use Email::Valid to validate e-mail addresses instead of
+      our own regrex. Email::Valid passed all our our existing regression
+      tests for e-mail addresses that should pass and fail. Email::Valid
+      also correctly recognizes emails with single quote characters in them.
+      These are valid, but our regex didn't recognize them.  (Mark Stosberg)
+
+    [INTERNALS]
+    - Typo in Constraints documentation corrected by K B Shiv Kumar (RT#32358)
+    - Add some tests and docs for "date_and_time" constraint, from
+      Data::FormValidator:::Constraints::Dates.  It appears  there may still
+      exist a leap-year bug with the date parser. See the TODO test in
+      t/dates_closure.t for details. An alternative is to use
+      Data::FormValidator::Constraints::DateTime 
+      (Mark Stosberg, Matt Christian)
+
 4.57 Thu Nov  1 22:47:13 EDT 2007
     [BUG FIXES]
     - The min max and length_between constraints now allow multi-line input, 

Modified: trunk/libdata-formvalidator-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/MANIFEST?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/MANIFEST (original)
+++ trunk/libdata-formvalidator-perl/MANIFEST Fri Jun 20 03:43:55 2008
@@ -3,7 +3,6 @@
 MANIFEST			This list of files
 MANIFEST.SKIP
 META.yml
-Makefile.PL
 README
 RELEASE_NOTES
 lib/Data/FormValidator.pm
@@ -51,6 +50,7 @@
 t/credit_card.t
 t/dates.t
 t/dates_closure.t
+t/dependency_coderef.t
 t/dependency_groups.t
 t/filter_constraints.t
 t/filters_builtin.t
@@ -75,6 +75,7 @@
 t/untaint.t
 t/upload.t
 t/upload_closure.t
+t/upload_mime_types.t
 t/upload_post_text.txt
 test/00_base.badformat
 test/00_base.profile

Modified: trunk/libdata-formvalidator-perl/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/MANIFEST.SKIP?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/MANIFEST.SKIP (original)
+++ trunk/libdata-formvalidator-perl/MANIFEST.SKIP Fri Jun 20 03:43:55 2008
@@ -25,6 +25,7 @@
 _darcs
 _build
 patches
+lib/Perl6
 rejects
 ^Build$
 

Modified: trunk/libdata-formvalidator-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/META.yml?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/META.yml (original)
+++ trunk/libdata-formvalidator-perl/META.yml Fri Jun 20 03:43:55 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name: Data-FormValidator
-version: 4.57
+version: 4.61
 author:
   - Mark Stosberg <mark at summersault.com>
 abstract: |-
@@ -9,6 +9,7 @@
 license: perl
 requires:
   Date::Calc: 5
+  Email::Valid: 0
   File::MMagic: 1.17
   Image::Size: 0
   MIME::Types: 1.005
@@ -21,26 +22,26 @@
 provides:
   Data::FormValidator:
     file: lib/Data/FormValidator.pm
-    version: 4.57
+    version: 4.61
   Data::FormValidator::Constraints:
     file: lib/Data/FormValidator/Constraints.pm
-    version: 4.51
+    version: 4.6
   Data::FormValidator::Constraints::Dates:
     file: lib/Data/FormValidator/Constraints/Dates.pm
-    version: 1.01
+    version: 4.60
   Data::FormValidator::Constraints::RegexpCommon:
     file: lib/Data/FormValidator/Results.pm
-    version: 4.55
+    version: 4.6
   Data::FormValidator::Constraints::Upload:
     file: lib/Data/FormValidator/Constraints/Upload.pm
-    version: 4.55
+    version: 4.6
   Data::FormValidator::ConstraintsFactory:
     file: lib/Data/FormValidator/ConstraintsFactory.pm
     version: 1.6
   Data::FormValidator::Filters:
     file: lib/Data/FormValidator/Filters.pm
-    version: 4.1
+    version: 4.6
   Data::FormValidator::Results:
     file: lib/Data/FormValidator/Results.pm
-    version: 4.55
+    version: 4.6
 generated_by: Module::Build version 0.2611

Modified: trunk/libdata-formvalidator-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/README?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/README (original)
+++ trunk/libdata-formvalidator-perl/README Fri Jun 20 03:43:55 2008
@@ -236,6 +236,15 @@
         "pay_type" => {
             check => [ qw( check_no ) ],
          }
+
+        # if cc_type is VISA or MASTERCARD require CVV
+        "cc_type" => sub {
+            my $dfv  = shift;
+            my $type = shift;
+        
+            return [ 'cc_cvv' ] if ($type eq "VISA" || $type eq "MASTERCARD");
+            return [ ];
+        },
      },
 
     This is for the case where an optional field has other requirements. The
@@ -245,7 +254,12 @@
     additional constraint is added that the optional field must equal a key
     for the dependencies to be added.
 
-    Any fields in the dependencies list that is missing when the target is
+    If the dependencies are specified as a code reference then the code will
+    be executed to determine the dependent fields. It is passed two
+    parameters, the object and the value of the field, and it should return
+    an array reference containing the list of dependent fields.
+
+    Any fields in the dependencies list that are missing when the target is
     present will be reported as missing.
 
   dependency_groups

Modified: trunk/libdata-formvalidator-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/debian/changelog?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/debian/changelog (original)
+++ trunk/libdata-formvalidator-perl/debian/changelog Fri Jun 20 03:43:55 2008
@@ -1,8 +1,24 @@
-libdata-formvalidator-perl (4.57-2) UNRELEASED; urgency=low
-
-  * Removed myself from uploaders.
-
- -- Joachim Breitner <nomeata at debian.org>  Wed, 13 Feb 2008 23:28:12 +0000
+libdata-formvalidator-perl (4.61-1) unstable; urgency=low
+  
+  [ Joachim Breitner ]
+  * Removed myself from uploaders. 
+  
+  [ Rene Mayorga ]
+  * New upstream release
+  * debian/rules 
+    + refresh with dh-make-perl
+    + don't install README file
+  * debian/control
+    + move libmodule-build-perl from B-D-I to B-D
+    + set standards-version to 3.8.0 (no changes)
+    + Add ${perl:Depends}, ${misc:Depends}
+      and remove 'perl' and 'perl-modules' from Depends field
+    + add libemail-valid-perl to B-D-I and Depends field
+    + add myself to uploaders
+  * debian/copyright - convert to new format
+  * debian/watch - set to version 3; change the regexp
+
+ -- Rene Mayorga <rmayorga at debian.org.sv>  Thu, 19 Jun 2008 20:43:43 -0600
 
 libdata-formvalidator-perl (4.57-1) unstable; urgency=low
 

Modified: trunk/libdata-formvalidator-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/debian/control?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/debian/control (original)
+++ trunk/libdata-formvalidator-perl/debian/control Fri Jun 20 03:43:55 2008
@@ -5,22 +5,23 @@
 Uploaders: Allard Hoeve <allard at byte.nl>, Gunnar Wolf <gwolf at debian.org>,
  Russ Allbery <rra at debian.org>,
  Niko Tyni <ntyni at iki.fi>, gregor herrmann <gregor+debian at comodo.priv.at>,
- Krzysztof Krzyzaniak (eloy) <eloy at debian.org>, Damyan Ivanov <dmn at debian.org>
-Build-Depends: debhelper (>= 5.0.0), perl (>= 5.8)
-Build-Depends-Indep: libmodule-build-perl, libregexp-common-perl,
- libimage-size-perl, libfile-mmagic-perl, libdate-calc-perl,
- libmime-types-perl, libtest-pod-perl, libcgi-simple-perl, perl-modules,
- libtemplate-perl, libperl6-junction-perl
-Standards-Version: 3.7.2
+ Krzysztof Krzyzaniak (eloy) <eloy at debian.org>, Damyan Ivanov <dmn at debian.org>,
+ Rene Mayorga <rmayorga at debian.org.sv>
+Build-Depends: debhelper (>= 5.0.0), perl (>= 5.8), libmodule-build-perl
+Build-Depends-Indep: libregexp-common-perl, libimage-size-perl, 
+ libfile-mmagic-perl, libdate-calc-perl, libmime-types-perl, 
+ libtest-pod-perl, libcgi-simple-perl, libtemplate-perl, 
+ libperl6-junction-perl, libemail-valid-perl
+Standards-Version: 3.8.0
 Homepage: http://search.cpan.org/dist/Data-FormValidator/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libdata-formvalidator-perl/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/
 
 Package: libdata-formvalidator-perl
 Architecture: all
-Depends: perl (>= 5.8), libregexp-common-perl, libimage-size-perl,
- libfile-mmagic-perl, libdate-calc-perl, libmime-types-perl, perl-modules,
- libperl6-junction-perl
+Depends: ${perl:Depends}, ${misc:Depends}, libregexp-common-perl, libimage-size-perl,
+ libfile-mmagic-perl, libdate-calc-perl, libmime-types-perl, libperl6-junction-perl,
+ libemail-valid-perl
 Description: Library for easily validating user input, mainly for HTML
  Provides a clean interface to present the user with template-generated
  forms, which will be later automatically validated, in a very easy to

Modified: trunk/libdata-formvalidator-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/debian/copyright?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/debian/copyright (original)
+++ trunk/libdata-formvalidator-perl/debian/copyright Fri Jun 20 03:43:55 2008
@@ -3,23 +3,54 @@
 
 It was downloaded from http://www.cpan.org/modules/by-module/Data/
 
-Copyright: 
-    Parts Copyright 2001-2006 by Mark Stosberg <markstos at cpan.org>, (Current
-    Maintainer)
+Upstream Author: Mark Stosberg <markstos at cpan.org>
+ Francis J. Lacoste and iNsu Innovations Inc. All
 
-    Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc. All
-    rights reserved. (Original Author)
+Files: lib/Data/FormValidator.pm
+Copyright: © 1999 Francis J. Lacoste, iNsu Innovations
+           © 1996-1999 by Michael J. Heins
+           © 1996-1999 by Bruce Albrecht
+           © 2005 by Mark Stosberg
+License: GPL-1+ | Artistic
+ This library is free software. You can modify and distribute it under the
+ same terms as Perl itself
 
-    Parts Copyright 1996-1999 by Michael J. Heins <mike at heins.net>
+Files: lib/Data/FormValidator/ConstraintsFactory.pm
+Copyright: © 2000 iNsu Innovations Inc.
+           © 1996-1999 by Michael J. Heins
+           © 1996-1999 by Bruce Albrecht
+           © 2005 by Mark Stosberg
+License: GPL-1+ | Artistic
+ This library is free software. You can modify and distribute it under the
+ same terms as Perl itself
 
-    Parts Copyright 1996-1999 by Bruce Albrecht
-    <bruce.albrecht at seag.fingerhut.com>
+Files: *
+Copyright: © 1999 Francis J. Lacoste, iNsu Innovations
+           © 1996-1999 by Michael J. Heins
+           © 1996-1999 by Bruce Albrecht
+           © 2005 by Mark Stosberg
+License: GPL-1+ | Artistic
+ This library is free software. You can modify and distribute it under the
+ same terms as Perl itself
 
-License:
-    This program is free software; you can redistribute it and/or modify if
-    under the terms as Perl itself - Licensed under either the GPL or the
-    Artistic licenses at your choice.
+Files: debian/*
+Copyright: © 2003 Gunnar Wolf
+           © 2004-2008 Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
+License: GPL-1+ | Artistic
+ This library is free software. You can modify and distribute it under the
+ same terms as Perl itself
 
-    In Debian systems you can find the whole text for the GPL license in 
-    /usr/share/common-licenses/GPL and for the Artistic license in 
-    /usr/share/common-licenses/Artistic
+
+The Perl license is:
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of either:
+
+    a) the GNU General Public License as published by the Free Software
+       Foundation; either version 1, or (at your option) any later
+       version, or
+
+    b) the "Artistic License" which comes with Perl.
+
+On Debian GNU/Linux systems, the complete text of the GNU General Public
+License can be found in `/usr/share/common-licenses/GPL' and the Artistic
+Licence in `/usr/share/common-licenses/Artistic'.

Modified: trunk/libdata-formvalidator-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/debian/rules?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/debian/rules (original)
+++ trunk/libdata-formvalidator-perl/debian/rules Fri Jun 20 03:43:55 2008
@@ -1,54 +1,48 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+export PERL_MM_USE_DEFAULT=1
 
-# This is the debhelper compatibility version to use.
-#export DH_COMPAT=4
-
-PACKAGE=$(shell dh_listpackages)
-TMP=$(CURDIR)/debian/$(PACKAGE)
-config = installdirs=vendor
-
+PERL   ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP     = $(CURDIR)/debian/$(PACKAGE)
 
 build: build-stamp
 build-stamp:
 	dh_testdir
-	# Add here commands to compile the package.
-	perl Build.PL $(config)
-	./Build test
+	$(PERL) Build.PL installdirs=vendor
+	$(PERL) Build
+	$(PERL) Build test
 	touch $@
 
 clean:
 	dh_testdir
 	dh_testroot
-	dh_clean build-stamp
-	[ ! -f Build ] || ./Build clean
-	rm -rf ./Build _build blib Makefile
-	dh_clean
+	dh_clean build-stamp install-stamp
+	[ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
 
-install:
+install: install-stamp
+install-stamp: build-stamp
 	dh_testdir
 	dh_testroot
 	dh_clean -k
+	$(PERL) Build install destdir=$(TMP) create_packlist=0
+	touch $@
 
-	./Build install destdir=$(TMP) create_packlist=0
+binary-arch:
+# We have nothing to do here for an architecture-independent package
 
-binary-arch:;
 binary-indep: build install
 	dh_testdir
 	dh_testroot
-	dh_installdocs README RELEASE_NOTES
+	dh_installdocs RELEASE_NOTES
 	dh_installchangelogs Changes
+	dh_perl
 	dh_compress
 	dh_fixperms
 	dh_installdeb
-	dh_perl
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
+.PHONY: build clean binary-indep binary-arch binary install

Modified: trunk/libdata-formvalidator-perl/debian/watch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/debian/watch?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/debian/watch (original)
+++ trunk/libdata-formvalidator-perl/debian/watch Fri Jun 20 03:43:55 2008
@@ -1,2 +1,2 @@
-version=2
-http://www.cpan.org/modules/by-module/Data/Data-FormValidator-(\d.*)\.tar\.gz
+version=3
+http://search.cpan.org/dist/Data-FormValidator/ .*/Data-FormValidator-v?(\d[\d_.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)

Modified: trunk/libdata-formvalidator-perl/lib/Data/FormValidator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/lib/Data/FormValidator.pm?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/lib/Data/FormValidator.pm (original)
+++ trunk/libdata-formvalidator-perl/lib/Data/FormValidator.pm Fri Jun 20 03:43:55 2008
@@ -33,7 +33,7 @@
 
 use vars qw( $VERSION $AUTOLOAD @ISA @EXPORT_OK %EXPORT_TAGS );
 
-$VERSION = '4.57';
+$VERSION = '4.61';
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -443,6 +443,15 @@
     "pay_type" => {
         check => [ qw( check_no ) ],
      }
+
+    # if cc_type is VISA or MASTERCARD require CVV
+    "cc_type" => sub {
+        my $dfv  = shift;
+        my $type = shift;
+        
+        return [ 'cc_cvv' ] if ($type eq "VISA" || $type eq "MASTERCARD");
+        return [ ];
+    },
  },
 
 This is for the case where an optional field has other requirements.  The
@@ -452,7 +461,12 @@
 constraint is added that the optional field must equal a key for the
 dependencies to be added.
 
-Any fields in the dependencies list that is missing when the target is present
+If the dependencies are specified as a code reference then the code will be
+executed to determine the dependent fields.  It is passed two parameters,
+the object and the value of the field, and it should return an array reference
+containing the list of dependent fields.
+
+Any fields in the dependencies list that are missing when the target is present
 will be reported as missing.
 
 =head2 dependency_groups

Modified: trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints.pm?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints.pm (original)
+++ trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints.pm Fri Jun 20 03:43:55 2008
@@ -23,7 +23,7 @@
 use strict;
 use vars qw/$AUTOLOAD @ISA @EXPORT_OK %EXPORT_TAGS $VERSION/;
 
-$VERSION = 4.51;
+$VERSION = 4.60;
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -261,6 +261,8 @@
 
 The checks are all inclusive, so a max length of '100' will allow the length 100. 
 
+Length is measured in perl characters as opposed to bytes or anything else.
+
 This constraint I<will> untaint your data if you have untainting turned on. However,
 a length check alone may not be enough to insure the safety of the data you are receiving.
 Using additional constraints to check the data is encouraged. 
@@ -275,8 +277,10 @@
     return sub {
         my ($dfv,$value) = @_;
         $dfv->name_this('length_between');
-        my ($match) = ($value =~ m/\A(.{$min,$max})\z/xms);
-        return $dfv->untainted_constraint_value($match);
+        return undef if ( ( length($value) > $max ) || ( length($value) < $min) );
+        # Use a regexp to untaint
+        $value=~/(.*)/;
+        return $dfv->untainted_constraint_value($1);
     }
 }
 
@@ -286,8 +290,10 @@
     return sub {
         my ($dfv,$value) = @_;
         $dfv->name_this('max_length');
-        my ($match) = ($value =~ m/\A(.{0,$max})\z/xms);
-        return $dfv->untainted_constraint_value($match);
+        return undef if ( length($value) > $max );
+        # Use a regexp to untaint
+        $value=~/(.*)/;
+        return $dfv->untainted_constraint_value($1);
     }
 }
 
@@ -297,8 +303,10 @@
     return sub {
         my ($dfv,$value) = @_;
         $dfv->name_this('min_length');
-        my ($match) = ($value =~ m/\A(.{$min,})\z/xms);
-        return $dfv->untainted_constraint_value($match);
+        return undef if ( length($value) < $min );
+        # Use a regexp to untaint
+        $value=~/(.*)/;
+        return $dfv->untainted_constraint_value($1);
     }
 }
 
@@ -348,13 +356,19 @@
 # Copyright 1996-1999 by Michael J. Heins <mike at heins.net>
 
 sub match_email {
-    my $email = shift;
-
-    if ($email =~ /^(([a-z0-9_\.\+\-\=\?\^\#]){1,64}\@(([a-z0-9\-]){1,251}\.){1,252}[a-z0-9]{2,4})$/i) {
-	    return $1;
-    }
-    else { 
-        return undef; 
+    my $in_email = shift;
+
+    require Email::Valid;
+    my $valid_email; 
+
+    # The extra check that the result matches the input prevents
+    # an address like this from being considered valid: Joe Smith <joe at smith.com>
+    if (    ($valid_email = Email::Valid->address($in_email) )
+        and ($valid_email eq $in_email)) { 
+        return $valid_email;
+    }
+    else {
+        return undef;
     }
 }
 
@@ -736,7 +750,7 @@
   # Near your profile	
   # Of course, you don't have to export/import if your constraints are in the same
   # package as the profile.  
-  use My::Constraints qw(coolness);
+  use My::Constraints 'coolness';
 
   # In your profile
   constraint_methods => {
@@ -769,7 +783,7 @@
 		# get other data to refer to
 	    my $data = $dfv->get_filtered_data;
 
-	    my $has_all_three = ($data->{personality} && $data->{smarts} && $data->{looks});
+	    my $has_all_three = ($data->{$personality} && $data->{$smarts} && $data->{$looks});
 		return ( ($val >= $min_cool) && ($val <= $max_cool) && $has_all_three );
 	}
   }

Modified: trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Dates.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Dates.pm?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Dates.pm (original)
+++ trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Dates.pm Fri Jun 20 03:43:55 2008
@@ -28,7 +28,7 @@
 	match_date_and_time
 );
 
-$VERSION = '1.01';
+$VERSION = '4.60';
 
 sub date_and_time {
 	my $fmt = shift;

Modified: trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Upload.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Upload.pm?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Upload.pm (original)
+++ trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Constraints/Upload.pm Fri Jun 20 03:43:55 2008
@@ -28,7 +28,7 @@
 	image_min_dimensions
 );
 
-$VERSION = 4.55;
+$VERSION = 4.60;
 
 sub file_format {
 	my %params = @_;

Modified: trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Filters.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Filters.pm?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Filters.pm (original)
+++ trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Filters.pm Fri Jun 20 03:43:55 2008
@@ -13,7 +13,7 @@
 use strict;
 use vars qw/$AUTOLOAD @ISA @EXPORT_OK %EXPORT_TAGS $VERSION/;
 
-$VERSION = 4.1;
+$VERSION = 4.60;
 
 require Exporter;
 @ISA = qw(Exporter);

Modified: trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Results.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Results.pm?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Results.pm (original)
+++ trunk/libdata-formvalidator-perl/lib/Data/FormValidator/Results.pm Fri Jun 20 03:43:55 2008
@@ -24,7 +24,7 @@
   'bool' => \&_bool_overload_based_on_success,
   fallback => 1;
 
-$VERSION = 4.55;
+$VERSION = 4.60;
 
 =pod
 
@@ -237,6 +237,15 @@
 					}
 				}
 			}
+            elsif (ref $deps eq "CODE") {
+                for my $val (_arrayify($valid{$field})) {
+                    my $returned_deps = $deps->($self, $val);
+                
+                    for my $dep (_arrayify($returned_deps)) {
+                        $required{$dep} = 1;
+                    }
+                }
+            }
             else {
                 for my $dep (_arrayify($deps)){
                     $required{$dep} = 1;

Modified: trunk/libdata-formvalidator-perl/t/FV_length.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/t/FV_length.t?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/t/FV_length.t (original)
+++ trunk/libdata-formvalidator-perl/t/FV_length.t Fri Jun 20 03:43:55 2008
@@ -71,3 +71,44 @@
 ok( $multiline_result->valid('echo'),      'multiline FV_length_between in bounds');
 ok( $multiline_result->invalid('foxtrot'), 'multiline FV_length_between too short');
 ok( $multiline_result->invalid('golf'),    'multiline FV_length_between too long' );
+
+# Test "long" results. Early implementations checked length with
+# regular expressions which limit length options to 32kb.
+# The 80000 char test string is an arbitrary length.
+# good a value as any other. And it's pretty long. 
+# Just for good measure we'll use the unicode smiley character (as seen in
+# perluniintro) in our test string.
+
+my $smiley = "\x{263a}";                # Thats "smiling face, white" folks!
+my $long_string = "x$smiley" x 40000;   # results in a 80000 length string
+my $long_result = Data::FormValidator->check(
+    {
+        alpha   => $long_string,
+        beta    => $long_string,
+        charlie => $long_string,
+        delta   => $long_string,
+        echo    => $long_string,
+        foxtrot => $long_string,
+        golf    => $long_string,
+    },
+    {
+        required => [qw/alpha beta charlie delta echo foxtrot golf/],
+        constraint_methods => {
+            alpha   => FV_max_length(80000),        # max length
+            beta    => FV_max_length(79999),        # too long
+            charlie => FV_min_length(80000),        # just long enough
+            delta   => FV_min_length(80001),        # too short
+            echo    => FV_length_between(79999,80001),    # just right 
+            foxtrot => FV_length_between(80001,80000),    # too short
+            golf    => FV_length_between(70000,79999),    # too long
+        },
+    },
+);
+
+ok( $long_result->valid('alpha'),     'long FV_max_length in bounds'    );
+ok( $long_result->invalid('beta'),    'long FV_max_length too long'     );
+ok( $long_result->valid('charlie'),   'long FV_min_length in bounds'    );
+ok( $long_result->invalid('delta'),   'long FV_min_length too short'    );
+ok( $long_result->valid('echo'),      'long FV_length_between in bounds');
+ok( $long_result->invalid('foxtrot'), 'long FV_length_between too short');
+ok( $long_result->invalid('golf'),    'long FV_length_between too long' );

Modified: trunk/libdata-formvalidator-perl/t/dates_closure.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/t/dates_closure.t?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/t/dates_closure.t (original)
+++ trunk/libdata-formvalidator-perl/t/dates_closure.t Fri Jun 20 03:43:55 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-use Test::More qw/no_plan/;
+use Test::More 'no_plan';
 BEGIN { 
 	use_ok('Data::FormValidator::Constraints::Dates') 
 };
@@ -59,4 +59,33 @@
 ok ($valids->{date_and_time_field_good}, 'expecting date_and_time success');
 ok ((grep /date_and_time_field_bad/, @$invalids), 'expecting date_and_time failure');
 
+{
+    my $r = Data::FormValidator->check({
+        # Testing leap years
+        date_and_time_field_good    => '02/29/2008',
+        date_and_time_field_bad_pat => '02/29/2008',
+        leap_seventy_six            => '02/29/1976',
+    },	
+    {
+        required => [qw/date_and_time_field_good date_and_time_field_bad_pat/],
+        constraint_methods => {
+            'date_and_time_field_good'    => date_and_time('MM/DD/YY(?:YY)?'),
+            # This pattern actually tests with a 3 digit year, not a four digit year, and fails
+            # on the date 02/29/2008, because 02/29/200 doesn't exist. 
+            'date_and_time_field_bad_pat' => date_and_time('MM/DD/YYY?Y?'),
+            'leap_seventy_six'            => date_and_time('MM/DD/YY(?:YY)?'),
+        },
+   });
+   my $valid = $r->valid;
+   ok ($valid->{date_and_time_field_good}, '02/29/2008 should pass MM/DD/YY(?:YY)?');
 
+   TODO: {
+       local $TODO = "leap year bug?";
+       ok ($valid->{leap_seventy_six},         '02/29/1976 should pass MM/DD/YY(?:YY)?');
+    };
+
+   # This one fails not because the date is bad, but because the pattern is not sensible
+   # It would be better to detect that the pattern was bad and fail that way, of course.
+   ok ( $r->invalid('date_and_time_field_bad_pat'), "02/29/2008 should fail MM/DD/YYY?Y?" );
+
+}

Modified: trunk/libdata-formvalidator-perl/t/procedural_valid.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-formvalidator-perl/t/procedural_valid.t?rev=21920&op=diff
==============================================================================
--- trunk/libdata-formvalidator-perl/t/procedural_valid.t (original)
+++ trunk/libdata-formvalidator-perl/t/procedural_valid.t Fri Jun 20 03:43:55 2008
@@ -96,6 +96,8 @@
 my $address_7 = 'Mark_Stosberg at summersault.com';
 ok(valid_email($address_7), "'$address_7' is a valid e-mail");
 
+my $addr_8 = "Mark_O'Doul\@summersault.com";
+ok(valid_email($addr_8), "'$addr_8' is a valid e-mail");
 
 
 




More information about the Pkg-perl-cvs-commits mailing list