r2640 - in /packages/libformvalidator-simple-perl/branches/upstream/current: Changes MANIFEST Makefile.PL lib/FormValidator/Simple.pm lib/FormValidator/Simple/Data.pm lib/FormValidator/Simple/Validator.pm t/20_numeric_cmp.t t/26_inarray.t

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Tue Apr 25 15:56:26 UTC 2006


Author: eloy
Date: Tue Apr 25 15:56:17 2006
New Revision: 2640

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=2640
Log:
Load /tmp/tmp.phziA0/libformvalidator-simple-perl-0.15 into
packages/libformvalidator-simple-perl/branches/upstream/current.

Added:
    packages/libformvalidator-simple-perl/branches/upstream/current/t/26_inarray.t
Modified:
    packages/libformvalidator-simple-perl/branches/upstream/current/Changes
    packages/libformvalidator-simple-perl/branches/upstream/current/MANIFEST
    packages/libformvalidator-simple-perl/branches/upstream/current/Makefile.PL
    packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple.pm
    packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Data.pm
    packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Validator.pm
    packages/libformvalidator-simple-perl/branches/upstream/current/t/20_numeric_cmp.t

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/Changes?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/Changes (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/Changes Tue Apr 25 15:56:17 2006
@@ -1,5 +1,17 @@
 Revision history for Perl extension FormValidator::Simple.
 
+0.15  Mon Apr 24 11:51:00 2006
+    - added IN_ARRAY validation
+      Thanks to Masahiro Nagano.
+
+    - bugfix:
+        fixed to use Scalar::Util::blessed instead of UNIVERSAL::isa
+        because of its unexpected work on perl 5.8.0.
+        Thanks to Toru Yamaguchi
+        
+        allow to handle 0 on 'BETWEEN' validation
+        Thanks to Masahiro Nagano.
+        
 0.14  Mon Mar 13 03:19:00 2006
     - added UINT validation
       Thanks to Tokuhirom.

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/MANIFEST?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/MANIFEST Tue Apr 25 15:56:17 2006
@@ -1,4 +1,8 @@
 Changes
+MANIFEST
+META.yml
+Makefile.PL
+README
 lib/FormValidator/Simple.pm
 lib/FormValidator/Simple/ArrayList.pm
 lib/FormValidator/Simple/Constants.pm
@@ -12,10 +16,6 @@
 lib/FormValidator/Simple/Result.pm
 lib/FormValidator/Simple/Results.pm
 lib/FormValidator/Simple/Validator.pm
-Makefile.PL
-MANIFEST
-META.yml
-README
 t/00_compile.t
 t/01_constraint.t
 t/02_constraints.t
@@ -42,5 +42,6 @@
 t/23_messages_yaml.t
 t/24_options.t
 t/25_all.t
+t/26_inarray.t
 t/conf/messages.yml
 t/lib/FormValidator/Simple/Plugin/Sample.pm

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/Makefile.PL?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/Makefile.PL Tue Apr 25 15:56:17 2006
@@ -14,6 +14,7 @@
         'Tie::IxHash'              => 1.21,
         'YAML'                     => 0.39,
         'List::MoreUtils'          => 0.16,
+        'Scalar::Util'             => 0,
 	}, # e.g., Module::Name => 1.1
 );
 

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple.pm?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple.pm (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple.pm Tue Apr 25 15:56:17 2006
@@ -11,7 +11,7 @@
 use FormValidator::Simple::Constants;
 use FormValidator::Simple::Messages;
 
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 __PACKAGE__->mk_accessors(qw/data prof results/);
 

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Data.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Data.pm?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Data.pm (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Data.pm Tue Apr 25 15:56:17 2006
@@ -1,6 +1,6 @@
 package FormValidator::Simple::Data;
 use strict;
-use UNIVERSAL;
+use Scalar::Util;
 use FormValidator::Simple::Exception;
 use FormValidator::Simple::Constants;
 
@@ -15,7 +15,7 @@
     my ($self, $input) = @_;
     $self->{_records} = {};
     my $errmsg = qq/Set input data as a hashref or object that has the method 'param()'./;
-    if ( UNIVERSAL::isa( $input, 'UNIVERSAL' ) ) {
+    if ( Scalar::Util::blessed($input) ) {
         unless ( $input->can('param') ) {
             FormValidator::Simple::Exception->throw($errmsg);
         }

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Validator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Validator.pm?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Validator.pm (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/lib/FormValidator/Simple/Validator.pm Tue Apr 25 15:56:17 2006
@@ -8,6 +8,7 @@
 use Email::Valid::Loose;
 use Date::Calc;
 use UNIVERSAL::require;
+use List::MoreUtils;
 
 __PACKAGE__->mk_classdata( options => { } );
 
@@ -268,7 +269,7 @@
     my $data = $params->[0];
     my $start = $args->[0];
     my $end   = $args->[1];
-    unless ( $start && $start =~ /^\d+$/ && $end && $end =~ /^\d+$/ ) {
+    unless ( defined($start) && $start =~ /^\d+$/ && defined($end) && $end =~ /^\d+$/ ) {
         FormValidator::Simple::Exception->throw(
         qq/Validation BETWEEN needs two numeric arguments./
         );
@@ -307,6 +308,12 @@
     return TRUE;
 }
 
+sub IN_ARRAY {
+    my ($class, $params, $args) = @_;
+    my $data = $params->[0] || '';
+    return (List::MoreUtils::any { $_ eq $data } @$args) ? TRUE : FALSE;
+}
+
 1;
 __END__
 

Modified: packages/libformvalidator-simple-perl/branches/upstream/current/t/20_numeric_cmp.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/t/20_numeric_cmp.t?rev=2640&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/t/20_numeric_cmp.t (original)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/t/20_numeric_cmp.t Tue Apr 25 15:56:17 2006
@@ -27,7 +27,7 @@
     age1 => [ 'INT', [qw/GREATER_THAN 30/] ],
     age2 => [ 'INT', [qw/LESS_THAN 20/] ],
     age3 => [ 'INT', [qw/EQUAL_TO 22/] ],
-    age4 => [ 'INT', [qw/BETWEEN 20 22/] ],
+    age4 => [ 'INT', [qw/BETWEEN 0 22/] ],
 ] );
 
 ok($r2->invalid('age1'));

Added: packages/libformvalidator-simple-perl/branches/upstream/current/t/26_inarray.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/branches/upstream/current/t/26_inarray.t?rev=2640&op=file
==============================================================================
--- packages/libformvalidator-simple-perl/branches/upstream/current/t/26_inarray.t (added)
+++ packages/libformvalidator-simple-perl/branches/upstream/current/t/26_inarray.t Tue Apr 25 15:56:17 2006
@@ -1,0 +1,18 @@
+use strict;
+use Test::More tests => 3;
+
+BEGIN{ use_ok("FormValidator::Simple") }
+
+use CGI;
+
+my $q = CGI->new;
+$q->param( foo => 'foo' );
+$q->param( bar => 'bar' );
+
+my $r = FormValidator::Simple->check( $q => [ 
+    foo => [ [qw/IN_ARRAY foo bar buz/] ],
+    bar => [ [qw/IN_ARRAY foo buz/] ],
+] );
+
+ok(!$r->invalid('foo'));
+ok($r->invalid('bar'));




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