blib/lib/Zed/Range/Set.pm

filter: Statementstmt 17.0% 7 / 41 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 16.6% 2 / 12 Podpod 0.0% 0 / 7 totaltotal 11.8% 9 / 76 CC 10 SCAR 19.9
CC
10
Cov
12%
add
12.0
intersection
12.0
diff
12.0
CRAP 7.3
« blib/lib/Zed/Config/Env.pm ↑ Summary blib/lib/Zed/Config.pm »
1 package Zed::Range::Set;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 use overload
4 1 '""' => \&dump,
5 '*' => \&descartes,
6 '&' => \&intersection,
7 '-' => \&diff,
8 1 ▶ '+' => \&union;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub new
11 {
12 0 ▶ my( $class, @vars) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
13 0 bless [@vars], $class;
14 }
15 0 ▶sub _list{ map{ ref $_ ? $_ : [$_] }@_ }
Subroutine _list: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
16  
17 sub add
18 {
19 0 ▶ my( $this, @vars ) = @_;
Subroutine add: not called CC=3 SCAR=24.8
Pod undocumented
20 0 ▶ push @$this, ref $_ ? $_->dump : $_ for @vars;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
21 }
22  
23 sub union
24 {
25 0 ▶ my( $left, $right ) = _list(@_);
Subroutine union: not called CC=1 SCAR=6.9
Pod undocumented
26 0 Zed::Range::Set->new(@$left, @$right);
27 }
28 sub descartes
29 {
30 0 ▶ my @values = _list( splice @_, 0, 2 );
Subroutine descartes: not called CC=2 SCAR=17.9
Pod undocumented
31 0 ▶ my( $left, $right ) = $_[0] ? reverse @values : @values;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 0 0 0
32
33 Zed::Range::Set->new(
34 0 map{ my $front = $_; map{ $front.$_ }@$right }@$left
35 );
36 }
37 sub intersection
38 {
39 0 ▶ my( $left, $right ) = @_;
Subroutine intersection: not called CC=3 SCAR=24.8
Pod undocumented
40  
41 0 ▶ $right = qr/$right/ unless ref $right;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $right 0 0 0
42 0 ▶ my $cut = ref $right eq "Regexp" ? sub{$_ =~ $right} : sub{my $t = shift; grep { $t =~ /$_/ } @$right};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
ref $right eq 'Regexp' ? : 0 0 0
43
44 0 Zed::Range::Set->new( grep{ $cut->($_) }@$left );
45 }
46 sub diff
47 {
48 0 ▶ my( $left, $right ) = @_;
Subroutine diff: not called CC=3 SCAR=24.8
Pod undocumented
49 0 ▶ $right = qr/$right/ unless ref $right;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $right 0 0 0
50 0 ▶ my $cut = ref $right eq "Regexp" ? sub{$_ !~ $right} : sub{my $t = shift; !grep { $t =~ /$_/ } @$right};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
ref $right eq 'Regexp' ? : 0 0 0
51 0 Zed::Range::Set->new( grep{ $cut->($_) }@$left );
52 }
53 sub dump
54 {
55 0 ▶ my $self = shift;
Subroutine dump: not called CC=2 SCAR=17.9
Pod undocumented
56 0 ▶ wantarray ? @$self : $self;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
57 }
58  
59  
60 1 1;
61  
62 __END__
« blib/lib/Zed/Config/Env.pm ↑ Summary blib/lib/Zed/Config.pm »