App/Plugin/MutexGroup/Meta/Class.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 6 / 6 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 91.6% 44 / 48 CC 8 SCAR 18.9
CC
8
Cov
95%
__ANON__
8.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.6
« App/Message/Envelope.pm ↑ Summary App/Meta/Role/Class/Simple.pm »
1 # ============================================================================
2 package MooseX::App::Plugin::MutexGroup::Meta::Class;
3 # ============================================================================
4  
5 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶around 'command_check_attributes' => sub {
Subroutine __ANON__: called CC=8 SCAR=20.8
9 7 my ( $orig, $self, $command_meta, $errors, $params ) = @_;
10 7 ▶ $command_meta ||= $self;
Condition33%1/3
$command_meta ||= $self
l!l&&r!l&&!r
700
MC/DC0%0/2
$command_meta ||= $self
$command_meta $self
Truth table33%1/3
A ||= B
A= $command_metaB= $self
ABresult
1X1
011
000
11  
12 7 my %mutex_groups;
13 7 foreach my $attribute (
14 $self->command_usage_attributes( $command_meta, 'all' ) ) {
15 25 ▶ push @{ $mutex_groups{ $attribute->mutexgroup } }, $attribute
Branch: 1 branch
BranchTrueFalseTotal
if $attribute->can("mutexgroup") and defined $attribute->mutexgroup 14 11 25
Condition100%3/3
$attribute->can("mutexgroup") and defined $attribute->mutexgroup
!ll&&!rl&&r
7414
MC/DC100%2/2
$attribute->can("mutexgroup") and defined $attribute->mutexgroup
$attribute->can("mutexgroup") defined $attribute->mutexgroup
Truth table100%3/3
A and B
A= $attribute->can("mutexgroup")B= defined $attribute->mutexgroup
ABresult
0X0
100
111
16 if $attribute->can('mutexgroup')
17 && defined $attribute->mutexgroup;
18 }
19  
20 7 foreach my $options ( values %mutex_groups ) {
21 my @initialized_options =
22 7 grep { defined $params->{ $_->name } }
23 @$options;
24  
25 7 ▶ unless ( scalar @initialized_options == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @initialized_options == 1) 2 5 7
26 2 my $error_msg;
27  
28 2 ▶ if (scalar @initialized_options == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @initialized_options == 0) { } 1 1 2
29 1 my $last = pop @$options;
30 $error_msg = "Either ".
31 1 join(",", map { $_->cmd_name_primary } @$options).
32 " or ".
33 $last->cmd_name_primary.
34 " must be specified";
35 } else {
36 1 my @list = map { $_->cmd_name_primary } @initialized_options;
37 1 my $last = pop(@list);
38  
39 1 $error_msg = "Options ".
40 join(",",@list).
41 " and ".
42 $last.
43 " are mutally exclusive";
44 }
45  
46 2 push @$errors,
47 $self->command_message(
48 header => $error_msg,
49 type => "error",
50 );
51 }
52 }
53  
54 7 return $self->$orig( $command_meta, $errors, $params );
55 3 };
56  
57 3 1;
« App/Message/Envelope.pm ↑ Summary App/Meta/Role/Class/Simple.pm »