| 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
Condition33%2/6
defined $name and defined $code and builtin::reftype($code) eq "CODE"
defined $name and defined $code
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"
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||