DBIx/Class/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/Filter/HtmlEscape.pm ↑ Summary Valiant/Filter/Numberize.pm »
1 package DBIx::Class::Valiant::Validates;
2  
3 9 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use Valiant::I18N;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 with 'Valiant::Validates';
8  
9 around default_validator_namespaces => sub {
10 483 ▶ my ($orig, $self, @args) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
11 483 return 'DBIx::Class::Valiant::Validator', $self->$orig(@args);
12 9 };
13  
14 around validate => sub {
15 434 ▶ my ($orig, $self, @args) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.1
16 434 ▶ return if $self->{__valiant_add};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"__valiant_add"} 0 434 434
17 434 return $self->$orig(@args);
18 9 };
19  
20 9 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/Filter/HtmlEscape.pm ↑ Summary Valiant/Filter/Numberize.pm »