blib/lib/MooseX/Policy/SemiAffordanceAccessor.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 62.5% 5 / 8 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 78.4% 40 / 51 CC 7 SCAR 17.5
CC
7
Cov
81%
__ANON__
8.4
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
↑ Summary
1 package MooseX::Policy::SemiAffordanceAccessor;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.02';
7 1 our $AUTHORITY = 'cpan:DROLSKY';
8  
9 1 ▶use constant attribute_metaclass => ## no critic ProhibitConstantPragma
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 'MooseX::Policy::SemiAffordanceAccessor::Attribute';
11  
12  
13 package MooseX::Policy::SemiAffordanceAccessor::Attribute; ## no critic ProhibitMultiplePackages
14  
15  
16 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 extends 'Moose::Meta::Attribute';
19  
20 before '_process_options' => sub
21 2 ▶{
Subroutine __ANON__: called CC=7 SCAR=21.3
22 2 my $class = shift;
23 2 my $name = shift;
24 2 my $options = shift;
25  
26 2 ▶ if ( exists $options->{is} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"is"} and not exists $options->{"reader"} || exists $options->{"writer"}) 2 0 2
Condition33%2/6
exists $options->{"is"} and not exists $options->{"reader"} || exists $options->{"writer"}
!ll&&!rl&&r
002
exists $options->{'reader'} || exists $options->{'writer'}
l!l&&r!l&&!r
002
MC/DC0%0/3
exists $options->{"is"} and not exists $options->{"reader"} || exists $options->{"writer"}
exists $options->{"is"} exists $options->{'reader'} exists $options->{'writer'}
Truth table25%1/4
A and not(B || C)
A= exists $options->{"is"}B= exists $options->{'reader'}C= exists $options->{'writer'}
ABCresult
0XX0
11X0
1010
1001
27 ! ( exists $options->{reader} || exists $options->{writer} ) )
28 {
29 2 ▶ if ( $options->{is} eq 'ro' )
Branch: 2 branches
BranchTrueFalseTotal
if ($options->{'is'} eq 'ro') { } 0 2 2
elsif ($options->{'is'} eq 'rw') { } 2 0 2
30 {
31 0 $options->{reader} = $name;
32 }
33 elsif ( $options->{is} eq 'rw' )
34 {
35 2 $options->{reader} = $name;
36  
37 2 my $prefix = 'set';
38 2 ▶ if ( $name =~ s/^_// )
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ s/^_//) 1 1 2
39 {
40 1 $prefix = '_set';
41 }
42  
43 2 $options->{writer} = $prefix . q{_} . $name;
44 }
45  
46 2 delete $options->{is};
47 }
48 1 };
49  
50  
51 1 1;
52  
53 __END__
↑ Summary