OptArgs2/Arg_CI.pm

filter: Statementstmt 88.8% 56 / 63 Branchbran 54.1% 13 / 24 Conditioncond 44.4% 4 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 4 totaltotal 71.4% 85 / 119 CC 17 SCAR 15.6
CC
17
Cov
76%
new
10.4
__CHECK
3.2
cmd
3.2
CRAP 4.7
« OptArgs2/Cmd_CI.pm ↑ Summary OptArgs2/Opt_CI.pm »
1 # Generated by Class::Inline version 0.0.1
2 # Date: Mon Oct 3 17:29:06 2022
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  
7 4 ▶package OptArgs2::Arg;BEGIN {require OptArgs2::OptArgBase;our@ISA=('OptArgs2::OptArgBase')};require Scalar::Util;our$_HAS;sub OptArgs2::Arg_CI::import {shift;$_HAS={@_ > 1 ? @_ : %{$_[0]}};$_HAS=$_HAS->{'has'}if exists$_HAS->{'has'}}our%_ATTRS;my%_BUILD_CHECK;sub new {my$class=shift;my$self={@_ ? @_ > 1 ? @_ : %{$_[0]}: ()};%_ATTRS=map {($_=>1)}keys %$self;bless$self,ref$class || $class;$_BUILD_CHECK{$class}//= do {my@possible=($class);my@BUILD;my@CHECK;while (@possible){no strict 'refs';my$c=shift@possible;push@BUILD,$c .'::BUILD' if exists &{$c .'::BUILD'};push@CHECK,$c .'::__CHECK' if exists &{$c .'::__CHECK'};push@possible,@{$c .'::ISA'}}[reverse(@CHECK),reverse(@BUILD)]};map {$self->$_}@{$_BUILD_CHECK{$class}};Carp::carp("OptArgs2::Arg attribute '$_' unexpected")for keys%_ATTRS;$self}sub __RO {my (undef,undef,undef,$sub)=caller(1);Carp::croak("attribute $sub is read-only")}sub __CHECK {no strict 'refs';my$_attrs=*{ref($_[0]).'::_ATTRS'};map {delete$_attrs->{$_}}keys %$_HAS;Scalar::Util::weaken($_[0]{'cmd'})if exists $_[0]{'cmd'}&& defined $_[0]{'cmd'}}sub cmd {if (@_ > 1){$_[0]{'cmd'}=$_[1];Scalar::Util::weaken($_[0]{'cmd'})if defined $_[0]{'cmd'};return $_[0]}$_[0]{'cmd'}}sub fallthru {$_[0]->__RO($_[1])if @_ > 1;$_[0]{'fallthru'}}sub greedy {$_[0]->__RO($_[1])if @_ > 1;$_[0]{'greedy'}}BEGIN {$INC{'OptArgs2/Arg.pm'}=__FILE__}
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __CHECK: called CC=3 SCAR=11.5
Subroutine __RO: not called CC=1 SCAR=0.2
Subroutine cmd: called CC=3 SCAR=11.5
Subroutine fallthru: called CC=2 SCAR=7.3
Subroutine greedy: called CC=2 SCAR=7.3
Subroutine import: called CC=3 SCAR=11.5
Subroutine new: called CC=9 SCAR=23.4
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Branch: 12 branches
BranchTrueFalseTotal
if exists $_[0]{"cmd"} and defined $_[0]{"cmd"} 6 0 6
if (@_ > 1) 0 4 4
if defined $_[0]{"cmd"} 0 0 0
if @_ > 1 0 3 3
if @_ > 1 0 8 8
@_ > 1 ? : 4 0 4
if exists $OptArgs2::Arg::_HAS->{"has"} 4 0 4
@_ ? : 6 0 6
@_ > 1 ? : 6 0 6
if (@possible) 6 3 9
if exists &{$c . '::BUILD';} 3 3 6
if exists &{$c . '::__CHECK';} 6 0 6
Condition44%4/9
exists $_[0]{"cmd"} and defined $_[0]{"cmd"}
!ll&&!rl&&r
006
ref $class || $class
l!l&&r!l&&!r
060
$_BUILD_CHECK{$class} //= do { my(@possible) = $class; my(@BUILD, @CHECK); while (@possible) { no strict 'refs'; my $c = shift @possible; push @BUILD, $c . '::BUILD' if exists &{$c . '::BUILD';}; push @CHECK, $c . '::__CHECK' if exists &{$c . '::__CHECK';}; push @possible, @{$c . '::ISA';}; } ; [reverse(@CHECK), reverse(@BUILD)] }
l!l&&r!l&&!r
330
MC/DC0%0/2
exists $_[0]{"cmd"} and defined $_[0]{"cmd"}
exists $_[0]{"cmd"} defined $_[0]{"cmd"}
MC/DC0%0/2
ref $class || $class
ref $class $class
MC/DC0%0/2
$_BUILD_CHECK{$class} //= do { my(@possible) = $class; my(@BUILD, @CHECK); while (@possible) { no strict 'refs'; my $c = shift @possible; push @BUILD, $c . '::BUILD' if exists &{$c . '::BUILD';}; push @CHECK, $c . '::__CHECK' if exists &{$c . '::__CHECK';}; push @possible, @{$c . '::ISA';}; } ; [reverse(@CHECK), reverse(@BUILD)] }
$_BUILD_CHECK{$class} do { my(@possible) = $class; my(@BUILD, @CHECK); while (@possible) { no strict 'refs'; my $c = shift @possible; push @BUILD, $c . '::BUILD' if exists &{$c . '::BUILD';}; push @CHECK, $c . '::__CHECK' if exists &{$c . '::__CHECK';}; push @possible, @{$c . '::ISA';}; } ; [reverse(@CHECK), reverse(@BUILD)] }
Truth table33%1/3
A and B
A= exists $_[0]{"cmd"}B= defined $_[0]{"cmd"}
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
Truth table66%2/3
A //= B
A= $_BUILD_CHECK{$class}B= do { my(@possible) = $class; my(@BUILD, @CHECK); while (@possible) { no strict 'refs'; my $c = shift @possible; push @BUILD, $c . '::BUILD' if exists &{$c . '::BUILD';}; push @CHECK, $c . '::__CHECK' if exists &{$c . '::__CHECK';}; push @possible, @{$c . '::ISA';}; } ; [reverse(@CHECK), reverse(@BUILD)] }
ABresult
1X1
011
000
8 4 1;
« OptArgs2/Cmd_CI.pm ↑ Summary OptArgs2/Opt_CI.pm »