r18821 - in /branches/upstream/libformvalidator-simple-perl/current: Changes MANIFEST MANIFEST.SKIP META.yml lib/FormValidator/Simple.pm t/16_plugin.t t/lib/MyNamespace/ t/lib/MyNamespace/MyPlugin.pm

roberto at users.alioth.debian.org roberto at users.alioth.debian.org
Sat Apr 19 15:52:36 UTC 2008


Author: roberto
Date: Sat Apr 19 15:52:35 2008
New Revision: 18821

URL: http://svn.debian.org/wsvn/?sc=1&rev=18821
Log:
[svn-upgrade] Integrating new upstream version, libformvalidator-simple-perl (0.23)

Added:
    branches/upstream/libformvalidator-simple-perl/current/MANIFEST.SKIP
    branches/upstream/libformvalidator-simple-perl/current/t/lib/MyNamespace/
    branches/upstream/libformvalidator-simple-perl/current/t/lib/MyNamespace/MyPlugin.pm
Modified:
    branches/upstream/libformvalidator-simple-perl/current/Changes
    branches/upstream/libformvalidator-simple-perl/current/MANIFEST
    branches/upstream/libformvalidator-simple-perl/current/META.yml
    branches/upstream/libformvalidator-simple-perl/current/lib/FormValidator/Simple.pm
    branches/upstream/libformvalidator-simple-perl/current/t/16_plugin.t

Modified: branches/upstream/libformvalidator-simple-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/Changes?rev=18821&op=diff
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/Changes (original)
+++ branches/upstream/libformvalidator-simple-perl/current/Changes Sat Apr 19 15:52:35 2008
@@ -1,4 +1,8 @@
 Revision history for Perl extension FormValidator::Simple.
+
+0.23  Thr Apr 17 21:17:00 2008
+    - Applied a patch which lets FVS loads plugin easily with +, like Catalyst.
+      Thanks to Jiro Nishiguchi.
 
 0.22  Tue Mar 6 20:07:00 2007
     - Applied a patch that lets it work as expected in case *set_messages* is invoked after *check*.

Modified: branches/upstream/libformvalidator-simple-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/MANIFEST?rev=18821&op=diff
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/MANIFEST (original)
+++ branches/upstream/libformvalidator-simple-perl/current/MANIFEST Sat Apr 19 15:52:35 2008
@@ -25,6 +25,7 @@
 lib/FormValidator/Simple/Validator.pm
 Makefile.PL
 MANIFEST
+MANIFEST.SKIP
 META.yml
 README
 t/00_compile.t
@@ -59,3 +60,4 @@
 t/conf/messages.yml
 t/conf/messages_ja.yml
 t/lib/FormValidator/Simple/Plugin/Sample.pm
+t/lib/MyNamespace/MyPlugin.pm

Added: branches/upstream/libformvalidator-simple-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/MANIFEST.SKIP?rev=18821&op=file
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libformvalidator-simple-perl/current/MANIFEST.SKIP Sat Apr 19 15:52:35 2008
@@ -1,0 +1,13 @@
+\bRCS\b
+\bCVS\b
+^MANIFEST\.
+^Makefile$
+~$
+\.old$
+^blib/
+^pm_to_blib
+^MakeMaker-\d
+\.gz$
+\.cvsignore
+^9\d_.*\.t
+\.svn

Modified: branches/upstream/libformvalidator-simple-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/META.yml?rev=18821&op=diff
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/META.yml (original)
+++ branches/upstream/libformvalidator-simple-perl/current/META.yml Sat Apr 19 15:52:35 2008
@@ -23,4 +23,4 @@
   Tie::IxHash: 1.21
   UNIVERSAL::require: 0.1
   YAML: 0.39
-version: 0.21
+version: 0.23

Modified: branches/upstream/libformvalidator-simple-perl/current/lib/FormValidator/Simple.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/lib/FormValidator/Simple.pm?rev=18821&op=diff
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/lib/FormValidator/Simple.pm (original)
+++ branches/upstream/libformvalidator-simple-perl/current/lib/FormValidator/Simple.pm Sat Apr 19 15:52:35 2008
@@ -12,7 +12,7 @@
 use FormValidator::Simple::Constants;
 use FormValidator::Simple::Messages;
 
-our $VERSION = '0.22';
+our $VERSION = '0.23';
 
 __PACKAGE__->mk_classaccessors(qw/data prof results/);
 __PACKAGE__->mk_classaccessor( messages => FormValidator::Simple::Messages->new );
@@ -20,7 +20,12 @@
 sub import {
     my $class = shift;
     foreach my $plugin (@_) {
-        my $plugin_class = "FormValidator::Simple::Plugin::".$plugin;
+        my $plugin_class;
+        if ($plugin =~ /^\+(.*)/) {
+            $plugin_class = $1;
+        } else {
+            $plugin_class = "FormValidator::Simple::Plugin::$plugin";
+        }
         $class->load_plugin($plugin_class);
     }
 }
@@ -565,6 +570,10 @@
 
     use FormValidator::Simple;
     FormValidator::Simple->load_plugin('FormValidator::Simple::Plugin::CreditCard');
+
+If you want to load plugin which name isn't in FormValidator::Simple::Plugin namespace, use +.
+
+    use FormValidator::Simple qw/+MyApp::ValidatorPlugin/;
 
 =head1 MESSAGE HANDLING
 

Modified: branches/upstream/libformvalidator-simple-perl/current/t/16_plugin.t
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/t/16_plugin.t?rev=18821&op=diff
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/t/16_plugin.t (original)
+++ branches/upstream/libformvalidator-simple-perl/current/t/16_plugin.t Sat Apr 19 15:52:35 2008
@@ -1,22 +1,29 @@
 use strict;
-use Test::More tests => 3;
+use Test::More tests => 5;
 use CGI;
 
 use lib 't/lib';
 
 BEGIN { require_ok("FormValidator::Simple") } 
 
-FormValidator::Simple->import('Sample');
+FormValidator::Simple->import(qw/Sample +MyNamespace::MyPlugin/);
 
 my $q = CGI->new;
 $q->param( sample1 => 'hogehoge' );
 $q->param( sample2 => 'sample'   );
 
+$q->param( myplugin1 => 'hogehoge' );
+$q->param( myplugin2 => 'myplugin' );
+
 my $r = FormValidator::Simple->check( $q => [
-    sample1 => [qw/SAMPLE/],
-    sample2 => [qw/SAMPLE/],
+    sample1   => [qw/SAMPLE/],
+    sample2   => [qw/SAMPLE/],
+    myplugin1 => [qw/MYPLUGIN/],
+    myplugin2 => [qw/MYPLUGIN/],
 ] );
 
 ok($r->invalid('sample1'));
 ok(!$r->invalid('sample2'));
 
+ok($r->invalid('myplugin1'));
+ok(!$r->invalid('myplugin2'));

Added: branches/upstream/libformvalidator-simple-perl/current/t/lib/MyNamespace/MyPlugin.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libformvalidator-simple-perl/current/t/lib/MyNamespace/MyPlugin.pm?rev=18821&op=file
==============================================================================
--- branches/upstream/libformvalidator-simple-perl/current/t/lib/MyNamespace/MyPlugin.pm (added)
+++ branches/upstream/libformvalidator-simple-perl/current/t/lib/MyNamespace/MyPlugin.pm Sat Apr 19 15:52:35 2008
@@ -1,0 +1,11 @@
+package MyNamespace::MyPlugin;
+use strict;
+use FormValidator::Simple::Constants;
+
+sub MYPLUGIN {
+    my ($class, $params, $args) = @_;
+    my $data = $params->[0];
+    return $data =~ /myplugin/ ? TRUE : FALSE;
+}
+
+1;




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