blib/lib/MooseX/NiftyDelegation.pm

filter: Statementstmt 95.3% 62 / 65 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 88.8% 16 / 18 Podpod 100% 2 / 2 totaltotal 86.7% 85 / 98 CC 6 SCAR 7.7
CC
6
Cov
89%
__ANON__
5.6
value_is
2.1
__ANON__
2.0
CRAP 2.2
↑ Summary
1 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 {
7 package MooseX::NiftyDelegation;
8 2 ▶ no thanks;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 our $AUTHORITY = 'cpan:TOBYINK';
10 1 our $VERSION = '0.003';
11 2 ▶ use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 Nifty => 'MooseX::NiftyDelegation::Trait::Attribute',
13 2 };
14 2 ▶ use Sub::Exporter -setup => {
Subroutine BEGIN: called CC=1 SCAR=0.0
15 exports => [qw/ Nifty value_is value_like /],
16 groups => { default => [qw/ Nifty /] },
17 2 };
18 2 ▶ use Scalar::Util qw( looks_like_number );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶ sub value_is ($) {
Subroutine value_is: called CC=2 SCAR=7.6
Pod documented
20 2 my $test = shift;
21 looks_like_number($test)
22 0 ▶ ? sub { $_ == $test }
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 2 ▶ : sub { $_ eq $test };
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
&looks_like_number($test) ? : 0 2 2
24 }
25 1 ▶ sub value_like ($) {
Subroutine value_like: called CC=1 SCAR=0.0
Pod documented
26 1 my $test = shift;
27 1 ▶ sub { $_ =~ $test };
Subroutine __ANON__: called CC=1 SCAR=0.0
28 }
29 }
30  
31 {
32 1 package MooseX::NiftyDelegation::Trait::Attribute;
33 2 ▶ no thanks;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 our $AUTHORITY = 'cpan:TOBYINK';
35 1 our $VERSION = '0.003';
36 2 ▶ use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 ▶ around _canonicalize_handles => sub {
Subroutine __ANON__: called CC=5 SCAR=17.2
38 1 my $orig = shift;
39 1 my $self = shift;
40 1 my %hash = $self->$orig(@_);
41 1 my $attr;
42 1 for my $k (keys %hash) {
43 4 ▶ next unless ref(my $body = $hash{$k});
Branch: 1 branch
BranchTrueFalseTotal
unless ref(my $body = $hash{$k}) 0 4 4
44 4 ▶ $attr ||= ($self->get_read_method || $self->get_read_method_ref);
Condition50%3/6
$attr ||= $self->get_read_method || $self->get_read_method_ref
l!l&&r!l&&!r
310
$self->get_read_method || $self->get_read_method_ref
l!l&&r!l&&!r
100
MC/DC0%0/3
$attr ||= $self->get_read_method || $self->get_read_method_ref
$attr $self->get_read_method $self->get_read_method_ref
Truth table0%0/4
A ||= B || C
A= $attrB= $self->get_read_methodC= $self->get_read_method_ref
ABCresult
1XX1
01X1
0011
0000
45 0 ▶ $hash{$k} = sub {
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine is_complete: called CC=1 SCAR=1.2
46 0 local $_ = $_[0]->$attr;
47 0 $body->(@_);
48 4 };
49 };
50 1 return %hash;
51 1 };
52 }
53  
54 1 1;
55 __END__
↑ Summary