Data/Printer/Filter.pm

filter: Statementstmt 100% 32 / 32 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 84.6% 44 / 52 CC 4 SCAR 7.9
CC
4
Cov
88%
__ANON__
4.6
import
1.0
BEGIN
1.0
CRAP 2.2
« Data/Printer/Filter/VSTRING.pm ↑ Summary Data/Printer/Profile/JSON.pm »
1 package Data::Printer::Filter;
2 35 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 35 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 35 ▶use Data::Printer::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 35 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 389 ▶sub import {
Subroutine import: called CC=1 SCAR=0.1
8 389 my $caller = caller;
9  
10 389 my %_filters_for = ();
11 461 ▶ my $filter = sub {
Subroutine __ANON__: called CC=4 SCAR=15.2
12 461 my ($name, $code) = @_;
13 461 ▶ Data::Printer::Common::_die( "syntax: filter 'Class', sub { ... }" )
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and defined $code and builtin::reftype($code) eq "CODE" 0 461 461
Condition33%2/6
defined $name and defined $code and builtin::reftype($code) eq "CODE"
!ll&&!rl&&r
00461
defined $name and defined $code
!ll&&!rl&&r
00461
MC/DC0%0/3
defined $name and defined $code and builtin::reftype($code) eq "CODE"
defined $name defined $code builtin::reftype($code) eq "CODE"
Truth table25%1/4
A and B and C
A= defined $nameB= defined $codeC= builtin::reftype($code) eq "CODE"
ABCresult
0XX0
10X0
1100
1111
14 unless defined $name
15 && defined $code
16 && Scalar::Util::reftype($code) eq 'CODE';
17  
18 461 my $target = Data::Printer::Common::_filter_category_for($name);
19 461 ▶ unshift @{$_filters_for{$target}{$name}}, sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
20 657 my ($item, $ddp) = @_;
21 657 $code->($item, $ddp);
22 461 };
23 389 };
24  
25 {
26 35 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
27 389 *{"$caller\::filter"} = $filter;
28 389 ▶ *{"$caller\::_filter_list"} = sub { \%_filters_for };
Subroutine __ANON__: called CC=1 SCAR=0.0
29 }
30 };
31  
32 35 1;
33 __END__
« Data/Printer/Filter/VSTRING.pm ↑ Summary Data/Printer/Profile/JSON.pm »