Attribute/Return.pm

filter: Statementstmt 61.1% 22 / 36 Branchbran 18.7% 3 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 53.8% 35 / 65 CC 9 SCAR 17.5
CC
9
Cov
48%
_ARRAY
12.0
_SCALAR
12.0
is_void
6.0
CRAP 5.8
« Attribute.pm ↑ Summary
1 package Capture::Attribute::Return;
2  
3 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $Capture::Attribute::Return::AUTHORITY = 'cpan:TOBYINK';
8 2 $Capture::Attribute::Return::VERSION = '0.003';
9 }
10  
11 2 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 use overload
14 2 ▶ '@{}' => '_ARRAY',
Subroutine BEGIN: called CC=1 SCAR=0.0
15 '""' => '_SCALAR',
16 2 '${}' => '_SCALAR';
17  
18 2 has wasarray => (
19 is => 'ro',
20 isa => 'Num|Undef',
21 required => 1,
22 );
23  
24 2 has value => (
25 is => 'ro',
26 required => 0,
27 predicate => 'has_value',
28 );
29  
30 sub _ARRAY
31 0 ▶{
Subroutine _ARRAY: not called CC=3 SCAR=24.8
32 0 my ($self) = @_;
33 0 ▶ return [] if $self->is_void;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_void 0 0 0
34 0 ▶ return $self->wasarray ? $self->value : [ $self->value ];
Branch: 1 branch
BranchTrueFalseTotal
$self->wasarray ? : 0 0 0
35 }
36  
37 sub _SCALAR
38 0 ▶{
Subroutine _SCALAR: not called CC=3 SCAR=24.8
39 0 my ($self) = @_;
40 0 ▶ return undef if $self->is_void;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_void 0 0 0
41 0 ▶ $self->wasarray ? do { my @a = @{$self->value}; scalar(@a) } : $self->value;
Branch: 1 branch
BranchTrueFalseTotal
$self->wasarray ? : 0 0 0
42 }
43  
44 sub is_list
45 1 ▶{
Subroutine is_list: called CC=2 SCAR=8.1
Pod documented
46 1 my ($self) = @_;
47 1 ▶ return 1 if $self->wasarray;
Branch: 1 branch
BranchTrueFalseTotal
if $self->wasarray 1 0 1
48 0 return;
49 }
50  
51 sub is_scalar
52 1 ▶{
Subroutine is_scalar: called CC=3 SCAR=12.0
Pod documented
53 1 my ($self) = @_;
54 1 my $wasarray = $self->wasarray;
55 1 ▶ return if $wasarray;
Branch: 1 branch
BranchTrueFalseTotal
if $wasarray 0 1 1
56 1 ▶ return 1 if defined $wasarray;
Branch: 1 branch
BranchTrueFalseTotal
if defined $wasarray 1 0 1
57 0 return;
58 }
59  
60 sub is_void
61 0 ▶{
Subroutine is_void: not called CC=2 SCAR=17.9
Pod documented
62 0 my ($self) = @_;
63 0 ▶ return if defined $self->wasarray;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->wasarray 0 0 0
64 0 return 1;
65 }
66  
67 2 __PACKAGE__
68 __END__
« Attribute.pm ↑ Summary