lib/HTML/FormFu/Role/CustomRoles.pm

filter: Statementstmt 91.1% 31 / 34 Branchbran 30.0% 3 / 10 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 68.8% 42 / 61 SCAR 23.8
CC
9
Cov
72%
roles
14.7
BEGIN
1.0
BEGIN
1.0
CRAP 10.8
« lib/HTML/FormFu/Deflator/CompoundSplit.pm ↑ Summary lib/HTML/FormFu/Filter/Encode.pm »
1 403 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Role::CustomRoles;
4 403 $HTML::FormFu::Role::CustomRoles::VERSION = '2.06';
5 403 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 403 ▶use Moose::Util qw( ensure_all_roles );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 403 ▶use List::Util 1.45 qw( uniq );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 has _roles => (
11 is => 'rw',
12 3 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
13 403 lazy => 1,
14 isa => 'ArrayRef',
15 );
16  
17 sub roles {
18 3 ▶ my $self = shift;
Subroutine roles: called CC=9 SCAR=26.8
Pod undocumented
19  
20 3 my @roles = @{ $self->_roles };
21 3 my @new;
22  
23 3 ▶ if ( 1 == @_ && 'ARRAY' eq ref $_[0] ) {
Branch: 2 branches
BranchTrueFalseTotal
if (1 == @_ and 'ARRAY' eq ref $_[0]) { } 3 0 3
elsif (@_) { } 0 0 0
Condition33%1/3
1 == @_ and "ARRAY" eq ref $_[0]
!ll&&!rl&&r
003
MC/DC0%0/2
1 == @_ and "ARRAY" eq ref $_[0]
1 == @_ "ARRAY" eq ref $_[0]
Truth table33%1/3
A and B
A= 1 == @_B= "ARRAY" eq ref $_[0]
ABresult
0X0
100
111
24 3 @new = @{ $_[0] };
25 }
26 elsif (@_) {
27 0 @new = @_;
28 }
29  
30 3 ▶ if (@new) {
Branch: 1 branch
BranchTrueFalseTotal
if (@new) 3 0 3
31 3 for my $role (@new) {
32 3 ▶ if ( !ref($role) && $role =~ s/^\+// ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $role and $role =~ s/^\+//) { } 3 0 3
elsif (not ref $role) { } 0 0 0
Condition33%1/3
not ref $role and $role =~ s/^\+//
!ll&&!rl&&r
003
MC/DC0%0/2
not ref $role and $role =~ s/^\+//
not ref $role $role =~ s/^\+//
Truth table33%1/3
not(A) and B
A= not ref $roleB= $role =~ s/^\+//
ABresult
0X0
100
111
33 3 push @roles, $role;
34 }
35 elsif ( !ref $role ) {
36 0 push @roles, "HTML::FormFu::Role::$role";
37 }
38 else {
39 0 push @roles, $role;
40 }
41 }
42  
43 3 @roles = uniq @roles;
44  
45 3 ensure_all_roles( $self, @roles );
46  
47 3 $self->_roles( \@roles );
48 }
49  
50 3 return [@roles];
51 }
52  
53 403 1;
54  
55 __END__
56  
57 =pod
58  
59 =encoding UTF-8
60  
61 =head1 NAME
62  
63 HTML::FormFu::Role::CustomRoles
64  
65 =head1 VERSION
66  
67 version 2.06
68  
69 =head1 AUTHOR
70  
71 Carl Franks <cpan@fireartist.com>
72  
73 =head1 COPYRIGHT AND LICENSE
74  
75 This software is copyright (c) 2018 by Carl Franks.
76  
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as the Perl 5 programming language system itself.
79  
80 =cut
« lib/HTML/FormFu/Deflator/CompoundSplit.pm ↑ Summary lib/HTML/FormFu/Filter/Encode.pm »