| 1 | package DBIx::Class::Valiant::Validates; | ||||||||||
| 2 | |||||||||||
| 3 | 12 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 12 | ▶ | use Valiant::I18N; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 12 | ▶ | use Scalar::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 12 | with 'Valiant::Validates'; | |||||||||
| 8 | |||||||||||
| 9 | 585 | ▶ | around default_validator_namespaces => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 585 | my ($orig, $self, @args) = @_; | |||||||||
| 11 | 585 | return 'DBIx::Class::Valiant::Validator', $self->$orig(@args); | |||||||||
| 12 | 12 | }; | |||||||||
| 13 | |||||||||||
| 14 | 545 | ▶ | around validate => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||
| 15 | 545 | my ($orig, $self, @args) = @_; | |||||||||
| 16 | 545 | ▶ | return if $self->{__valiant_add}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 545 | return $self->$orig(@args); | |||||||||
| 18 | 12 | }; | |||||||||
| 19 | |||||||||||
| 20 | 12 | 1; | |||||||||
| 21 | |||||||||||
| 22 | =head1 NAME | ||||||||||
| 23 | |||||||||||
| 24 | DBIx::Class::Valiant::Validates - Add Valiant to DBIC | ||||||||||
| 25 | |||||||||||
| 26 | =head1 DESCRIPTION | ||||||||||
| 27 | |||||||||||
| 28 | This is a role which extends L<Valiant::Validates> so that is finds validators | ||||||||||
| 29 | under the L<DBIx::Class::Valiant::Validator> namespace. It adds this namespace | ||||||||||
| 30 | to the top of the call list, that way we can if needed override core validators | ||||||||||
| 31 | with versions that work properly under L<DBIx::Class>. | ||||||||||
| 32 | |||||||||||
| 33 | You shouldn't need to use this code directly yourself, it gets added automatically | ||||||||||
| 34 | for you. | ||||||||||
| 35 | |||||||||||
| 36 | =head1 SEE ALSO | ||||||||||
| 37 | |||||||||||
| 38 | See L<Valiant>, L<DBIx::Class::Valiant> | ||||||||||
| 39 | |||||||||||
| 40 | =head1 AUTHOR | ||||||||||
| 41 | |||||||||||
| 42 | See L<Valiant>. | ||||||||||
| 43 | |||||||||||
| 44 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 45 | |||||||||||
| 46 | See L<Valiant>. | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||