FormValidator::Simple::Plugin::DBIC::Unique - unique check for DBIC
use FormValidator::Simple qw/DBIC::Unique/; # check single column FormValidator::Simple->check( $q => [ name => [ [qw/DBIC_UNIQUE TableClass name/] ], ] ); # check multiple columns FormValidator::Simple->check( $q => [ { unique => [qw/name email/] } => [ [qw/DBIC_UNIQUE TableClass name mail/] ], ] ); # check multiple columns including '!=' check # set "!" as prefix for key-name FormValidator::Simple->check( $q => [ { unique => [qw/id name email/] } => [ [qw/DBIC_UNIQUE Table !id name mail/] ] ] ); # when the class name is too long... FormValidator::Simple->check( $q => [ name => [ [qw/DBIC_UNIQUE MyProj::Model::User name/] ], ] ); # you can set cdbi_base_class in option. FormValidator::Simple->set_option( dbic_base_class => 'MyProj::Model' ); FormValidator::Simple->check( $q => [ name => [ [qw/DBIC_UNIQUE User name/] ], ] ); # you also can pass resultset object. # in catalyst application, FormValidator::Simple->check( $q => [ name => [ ['DBIC_UNIQUE', $c->model('Schema::User'), 'username' ] ], ] ); # in case you use schema, FormValidator::Simple->check( $q => [ name => [ [ 'DBIC_UNIQUE', $c->model('Schema')->resultset('User'), 'username' ] ], ] ); FormValidator::Simple->check( $q => [ name => [ [ 'DBIC_UNIQUE', $schema->resultset('User'), 'username' ] ], ] );
This module is a plugin for FormValidator::Simple. This provides you a validation for unique check with DBIC table class.
FormValidator::Simple
Lyo Kato <lyo.kato@gmail.com>
Basic Idea: Masahiro Nagano <kazeburo@gmail.com>
Copyright (C) 2005 by Lyo Kato
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install FormValidator::Simple::Plugin::DBIC::Unique, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FormValidator::Simple::Plugin::DBIC::Unique
CPAN shell
perl -MCPAN -e shell install FormValidator::Simple::Plugin::DBIC::Unique
For more information on module installation, please visit the detailed CPAN module installation guide.