IO/All/Base.pm

filter: Statementstmt 58.7% 138 / 235 Branchbran 44.0% 22 / 50 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 78.6% 48 / 61 Podpod 0.0% 0 / 3 totaltotal 58.1% 211 / 363 CC 34 SCAR 15.9
CC
34
Cov
55%
__ANON__
30.0
__ANON__
13.1
__ANON__
12.0
CRAP 4.9
« IO/All/Dir.pm ↑ Summary IO/All/IO.pm »
1 package IO::All::Base;
2  
3 # use Mo qw'default build import exporter xxx';
4 # The following line of code was produced from the previous line by
5 # Mo::Inline version 0.38
6 0 ▶no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{my$c=shift;my$s=bless{@_},$c;my%n=%{$c.::.':E'};map{$s->{$_}=$n{$_}->()if!exists$s->{$_}}keys%n;$s};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};@_=(default,@_)if!($#_%2);$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($m,$n,%a)=@_;exists$a{default}or return$m;my($d,$r)=$a{default};my$g='HASH'eq($r=ref$d)?sub{+{%$d}}:'ARRAY'eq$r?sub{[@$d]}:'CODE'eq$r?$d:sub{$d};my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=$g and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$g->(@_):$m->(@_)}}};*{$M.'build::e'}=sub{my($P,$e)=@_;$e->{new}=sub{$c=shift;my$s=&{$M.Object::new}($c,@_);my@B;do{@B=($c.::BUILD,@B)}while($c)=@{$c.::ISA};exists&$_&&&$_($s)for@B;$s}};my$i=\&import;*{$M.import}=sub{(@_==2 and not$_[1])?pop@_:@_==1?push@_,grep!/import/,@f:();goto&$i};*{$M.'exporter::e'}=sub{my($P)=@_;if(@{$M.EXPORT}){*{$P.$_}=\&{$M.$_}for@{$M.EXPORT}}};use constant XXX_skip=>1;my$dm='YAML::XS';*{$M.'xxx::e'}=sub{my($P,$e)=@_;$e->{WWW}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::WWW(@_)};$e->{XXX}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::XXX(@_)};$e->{YYY}=sub{require XXX;local$XXX::DumpModule=$dm;XXX::YYY(@_)};$e->{ZZZ}=sub{require XXX;local$XXX::DumpModule=$dm}};@f=qw[default build import exporter xxx];use strict;use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine BEGIN: called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=2 SCAR=8.4
Subroutine __ANON__: called CC=4 SCAR=16.6
Subroutine __ANON__: called CC=1 SCAR=0.8
Subroutine __ANON__: called CC=3 SCAR=13.1
Subroutine __ANON__: called CC=2 SCAR=8.4
Subroutine __ANON__: called CC=1 SCAR=0.8
Subroutine __ANON__: called CC=8 SCAR=25.7
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: called CC=3 SCAR=13.1
Subroutine __ANON__: called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=4 SCAR=16.6
Subroutine __ANON__: called CC=4 SCAR=16.6
Subroutine __ANON__: called CC=3 SCAR=13.1
Subroutine __ANON__: called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Branch: 17 branches
BranchTrueFalseTotal
if not exists $s->{$_} 0 0 0
if $e{"M"} 0 16 16
unless $#_ % 2 0 18 18
$#_ ? : 9 22 31
exists $a{"default"} or return $m 9 9 18
'HASH' eq ($r = ref $d) ? : 0 9 9
'ARRAY' eq $r ? : 0 9 9
'CODE' eq $r ? : 9 0 9
exists $a{'lazy'} ? : 0 9 9
$i or do { $P . ':E' }->{$n} = $g and return $m 9 0 9
$#_ ? : 1 17 18
!exists $_[0]{$n} ? : 7 10 17
($c) = @{$c . '::ISA';} and do { do { @B = ($c . '::BUILD', @B) } } 0 0 0
exists &$_ and &$_($s) 0 0 0
@_ == 2 && !$_[1] ? : 0 16 16
@_ == 1 ? : 16 0 16
if (@{$M . 'EXPORT';}) 16 0 16
Condition28%2/7
$i || (do { $P . ':E' }->{$n} = $g) && (return $m)
l!l
90
do { $P . ':E' }->{$n} = $g and return $m
!ll
00
@_ == 2 and not $_[1]
!ll&&!rl&&r
1600
MC/DC0%0/2
$i || (do { $P . ':E' }->{$n} = $g) && (return $m)
$i do { $P . ':E' }->{$n} = $g
MC/DC0%0/2
@_ == 2 and not $_[1]
@_ == 2 not $_[1]
Truth table33%1/3
A || B
A= $iB= do { $P . ':E' }->{$n} = $g
ABresult
1X1
011
000
Truth table33%1/3
A and not(B)
A= @_ == 2B= not $_[1]
ABresult
0X0
100
111
7  
8 3 our @EXPORT = qw(chain option);
9  
10 12 ▶sub option {
Subroutine option: called CC=2 SCAR=6.9
Pod undocumented
11 12 my $package = caller;
12 12 my ($field, $default) = @_;
13 12 ▶ $default ||= 0;
Condition50%1/2
$default ||= 0
l!l
012
MC/DC0%0/1
$default ||= 0
$default
Truth table50%1/2
A
A= $default
Aresult
11
00
14 12 field("_$field", $default);
15 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 12 *{"${package}::$field"} =
17 2 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
18 2 my $self = shift;
19 2 ▶ $self->{"_$field"} = @_ ? shift(@_) : 1;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1 1 2
20 2 return $self;
21 12 };
22 }
23  
24 0 ▶sub chain {
Subroutine chain: not called CC=1 SCAR=4.4
Pod undocumented
25 0 my $package = caller;
26 0 my ($field, $default) = @_;
27 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 0 *{"${package}::$field"} =
29 0 ▶ sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
30 0 my $self = shift;
31 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
32 0 $self->{$field} = shift;
33 0 return $self;
34 }
35 0 ▶ return $default unless exists $self->{$field};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{$field} 0 0 0
36 0 return $self->{$field};
37 0 };
38 }
39  
40 12 ▶sub field {
Subroutine field: called CC=2 SCAR=9.7
Pod undocumented
41 12 my $package = caller;
42 12 my ($field, $default) = @_;
43 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 12 ▶ return if defined &{"${package}::$field"};
Branch: 1 branch
BranchTrueFalseTotal
if defined &{"${package}::$field";} 3 9 12
45 9 *{"${package}::$field"} =
46 0 ▶ sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
47 0 my $self = shift;
48 0 ▶ unless (exists $self->{$field}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{$field}) 0 0 0
49 0 ▶ $self->{$field} =
Branch: 2 branches
BranchTrueFalseTotal
ref $default eq 'ARRAY' ? : 0 0 0
ref $default eq 'HASH' ? : 0 0 0
50 ref($default) eq 'ARRAY' ? [] :
51 ref($default) eq 'HASH' ? {} :
52 $default;
53 }
54 0 ▶ return $self->{$field} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
55 0 $self->{$field} = shift;
56 9 };
57 }
58  
59 package IO::All::OO::Object;
60  
61 0 ▶sub throw {
Subroutine throw: not called CC=1 SCAR=6.9
62 0 my $self = shift;
63 0 require Carp;
64 0 Carp::croak(@_);
65 }
66  
67 3 1;
« IO/All/Dir.pm ↑ Summary IO/All/IO.pm »