The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Plugin::FormValidator::Simple::OwnCheck - Validator for Catalyst with FormValidator::Simple

SYNOPSIS

    use Catalyst qw/FormValidator::Simple::OwnCheck FillInForm/;

    # set option
    MyApp->config->{validator} = {
        plugins                                 => ['CreditCard', 'Japanese'],
        plugins_owncheck                => ['MyApp::Checker'],
        options                                 => { charset => 'euc'},
    }

in your Checker.pm

        package MyApp::Checker;
        use strict;
        use FormValidator::Simple::Exception;
        use FormValidator::Simple::Constants;
        
        our $VERSION = '0.01';
        
        sub NUMBER {
                my ( $self, $params, $args ) = @_;
        
                my $is_number = $params->[0] =~ m{^\d+$} ? 1 : 0;
                return $is_number ? TRUE : FALSE;       
        } 
        1;  

in your controller

    sub defaulti : Private {

        my ($self, $c) = @_;
        
        #this will check the param1 whether is NOT_BLANK and is NUMBER
        $c->form(
            param1 => [ qw/NOT_BLANK/, 'NUMBER' ],
        );
        
        #...
    
    }

DESCRIPTION

This plugin allows you to validate request parameters with a checker of your application namespace , no need to package your checker in the namespace of FormValidator::Simple. See FormValidator::Simple for more information.

This behaves like as Catalyst::Plugin::FormValidator.

SEE ALSO

FormValidator::Simple

Catalyst

AUTHOR

ADONG <lt>dxluo83@gmail.com<gt>

COPYRIGHT AND LICENSE

Copyright(C) 2006 by ADONG

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.