r3515 - in /packages/libdata-formvalidator-perl/branches/upstream/current: Changes META.yml lib/Data/FormValidator.pm lib/Data/FormValidator/Constraints.pm

gwolf at users.alioth.debian.org gwolf at users.alioth.debian.org
Mon Aug 28 22:19:51 UTC 2006


Author: gwolf
Date: Mon Aug 28 22:19:50 2006
New Revision: 3515

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3515
Log:
Load /tmp/tmp.vUtJq28439/libdata-formvalidator-perl-4.40 into
packages/libdata-formvalidator-perl/branches/upstream/current.

Modified:
    packages/libdata-formvalidator-perl/branches/upstream/current/Changes
    packages/libdata-formvalidator-perl/branches/upstream/current/META.yml
    packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator.pm
    packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator/Constraints.pm

Modified: packages/libdata-formvalidator-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libdata-formvalidator-perl/branches/upstream/current/Changes?rev=3515&op=diff
==============================================================================
--- packages/libdata-formvalidator-perl/branches/upstream/current/Changes (original)
+++ packages/libdata-formvalidator-perl/branches/upstream/current/Changes Mon Aug 28 22:19:50 2006
@@ -1,3 +1,16 @@
+4.40 Mon Aug 21 19:41:24 EDT 2006
+
+    [BUG FIXES]
+    - All FV_ closures are now exported with ":closures". (Ed Pigg, Mark Stosberg)
+
+    [ENHANCEMENTS]
+    - Added new constraint for the common case of comparing one field with another,
+      such as a word confirmation field. Example:
+          constraint_methods => {  
+            password  => FV_eq_with('password_confirm'),
+          }
+      (Mark Stosberg)  
+
 4.30 Mon Jul 10 21:41:37 EDT 2006
     [ENHANCEMENTS]
     - A new method for constraint writers has been added: untainted_constraint_value().    

Modified: packages/libdata-formvalidator-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libdata-formvalidator-perl/branches/upstream/current/META.yml?rev=3515&op=diff
==============================================================================
--- packages/libdata-formvalidator-perl/branches/upstream/current/META.yml (original)
+++ packages/libdata-formvalidator-perl/branches/upstream/current/META.yml Mon Aug 28 22:19:50 2006
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name: Data-FormValidator
-version: 4.30
+version: 4.40
 author:
   - Mark Stosberg <mark at summersault.com>
 abstract: |-
@@ -18,10 +18,10 @@
 provides:
   Data::FormValidator:
     file: lib/Data/FormValidator.pm
-    version: 4.30
+    version: 4.40
   Data::FormValidator::Constraints:
     file: lib/Data/FormValidator/Constraints.pm
-    version: 4.3
+    version: 4.4
   Data::FormValidator::Constraints::Dates:
     file: lib/Data/FormValidator/Constraints/Dates.pm
     version: 1.01

Modified: packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator.pm?rev=3515&op=diff
==============================================================================
--- packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator.pm (original)
+++ packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator.pm Mon Aug 28 22:19:50 2006
@@ -31,7 +31,7 @@
 
 use vars qw( $VERSION $AUTOLOAD @ISA @EXPORT_OK %EXPORT_TAGS );
 
-$VERSION = '4.30';
+$VERSION = '4.40';
 
 require Exporter;
 @ISA = qw(Exporter);

Modified: packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator/Constraints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator/Constraints.pm?rev=3515&op=diff
==============================================================================
--- packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator/Constraints.pm (original)
+++ packages/libdata-formvalidator-perl/branches/upstream/current/lib/Data/FormValidator/Constraints.pm Mon Aug 28 22:19:50 2006
@@ -23,7 +23,7 @@
 use strict;
 use vars qw/$AUTOLOAD @ISA @EXPORT_OK %EXPORT_TAGS $VERSION/;
 
-$VERSION = 4.30;
+$VERSION = 4.40;
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -74,12 +74,17 @@
         }
     }
 
-    @EXPORT_OK = (
-        @closures,
-        qw(
+    my @FVs = (qw/
         FV_length_between
         FV_min_length
         FV_max_length
+        FV_eq_with
+    /);
+
+    @EXPORT_OK = (
+        @closures,
+        @FVs,
+        qw(
         valid_american_phone
         valid_cc_exp
         valid_cc_number
@@ -111,7 +116,7 @@
     %EXPORT_TAGS = (
         # regexp common is correctly empty here, because we handle the case on the fly with the import function below. 
         regexp_common => [],
-        closures => \@closures, 
+        closures => [ @closures, @FVs ], 
         validators => [qw/
             valid_american_phone
             valid_cc_exp
@@ -297,6 +302,37 @@
     }
 }
 
+=head2 FV_eq_with 
+
+  use Data::FormValidator::Constraints qw( FV_eq_with );
+
+  constraint_methods => {  
+    password  => FV_eq_with('password_confirm'),
+  }
+
+Compares the current field to another field.
+A constraint name of C<eq_with> will be set.
+
+=cut
+
+sub FV_eq_with {
+    my ($other_field) = @_;
+    return sub {
+        my $dfv = shift;
+        $dfv->name_this('eq_with');
+
+        my $curr_val  = $dfv->get_current_constraint_value;
+
+        my $data = $dfv->get_input_data;
+        # Sometimes the data comes through both ways...
+        my $other_val = (ref $data->{$other_field}) ? $data->{$other_field}[0] : $data->{$other_field};
+
+        return ($curr_val eq $other_val);
+    }
+
+}
+
+
 =head2 email
 
 Checks if the email LOOKS LIKE an email address. This should be sufficient




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