Valiant/Validates.pm

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 96.0% 24 / 25 CC 2 SCAR 3.0
CC
2
Cov
95%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Valiant/Util/Exception.pm ↑ Summary Valiant/Util/Exception/BadParameters.pm »
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
BranchTrueFalseTotal
if $self->{"__valiant_add"} 0 545 545
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
« Valiant/Util/Exception.pm ↑ Summary Valiant/Util/Exception/BadParameters.pm »