Commando/Program.pm

filter: Statementstmt 100% 35 / 35 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 100% 45 / 45 CC 2 SCAR 2.0
CC
2
Cov
100%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Commando/Presenter.pm ↑ Summary Commando.pm »
1 package App::Commando::Program;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Getopt::Long qw( GetOptionsFromArray );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 extends 'App::Commando::Command';
11  
12 4 has 'config' => ( is => 'ro' );
13  
14 9 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 9 my ($orig, $self, $name) = @_;
16  
17 return {
18 config => {},
19 9 %{$self->$orig($name)}
20 };
21 4 };
22  
23 9 ▶around go => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
24 9 my ($orig, $self, $argv) = @_;
25  
26 9 ▶ if (!defined $argv) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $argv) 8 1 9
27 8 $argv = \@ARGV;
28 }
29  
30 9 my $cmd = $self->$orig($argv, $self->config);
31  
32 # Run through all options again in case there are any unknown ones
33 9 Getopt::Long::Configure('no_pass_through');
34 {
35 # Treat Getopt::Long warnings as fatal errors
36 9 ▶ local $SIG{__WARN__} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
37 1 croak @_;
38 9 };
39 GetOptionsFromArray($argv,
40 9 { map { $_->for_get_options => undef } @{$self->options} });
41 }
42  
43 8 $cmd->execute($argv, $self->config);
44 4 };
45  
46 4 1;
47  
48 __END__
« Commando/Presenter.pm ↑ Summary Commando.pm »