Accessor/Fast.pm

filter: Statementstmt 81.2% 39 / 48 Branchbran 55.5% 20 / 36 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.2% 13 / 16 Podpod 100% 3 / 3 totaltotal 72.8% 75 / 103 CC 19 SCAR 11.2
CC
19
Cov
70%
__ANON__
4.0
__ANON__
4.0
__ANON__
4.0
CRAP 3.1
« Accessor/Faster.pm ↑ Summary
1 package Class::Accessor::Fast;
2 4 ▶use base 'Class::Accessor';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use B 'perlstring';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 $Class::Accessor::Fast::VERSION = '0.51';
6  
7 6 ▶sub make_accessor {
Subroutine make_accessor: called CC=1 SCAR=0.9
Pod documented
8 6 my ($class, $field) = @_;
9  
10 eval sprintf q{
11 sub {
12 return $_[0]{%s} if scalar(@_) == 1;
13 return $_[0]{%s} = scalar(@_) == 2 ? $_[1] : [@_[1..$#_]];
14 }
15 0 ▶ }, map { perlstring($_) } $field, $field;
Subroutine __ANON__: called CC=3 SCAR=13.8
Subroutine __ANON__: called CC=3 SCAR=13.8
Subroutine __ANON__: not called CC=3 SCAR=13.8
Subroutine __ANON__: called CC=3 SCAR=13.8
Subroutine __ANON__: not called CC=3 SCAR=13.8
Subroutine __ANON__: called CC=3 SCAR=13.8
Branch: 12 branches
BranchTrueFalseTotal
if scalar @_ == 1 4 2 6
scalar @_ == 2 ? : 1 1 2
if scalar @_ == 1 1 1 2
scalar @_ == 2 ? : 1 0 1
if scalar @_ == 1 0 0 0
scalar @_ == 2 ? : 0 0 0
if scalar @_ == 1 1 1 2
scalar @_ == 2 ? : 1 0 1
if scalar @_ == 1 0 0 0
scalar @_ == 2 ? : 0 0 0
if scalar @_ == 1 2 0 2
scalar @_ == 2 ? : 0 0 0
16 }
17  
18 7 ▶sub make_ro_accessor {
Subroutine make_ro_accessor: called CC=1 SCAR=0.6
Pod documented
19 7 my($class, $field) = @_;
20  
21 eval sprintf q{
22 sub {
23 return $_[0]{%s} if @_ == 1;
24 my $caller = caller;
25 $_[0]->_croak(sprintf "'$caller' cannot alter the value of '%%s' on objects of class '%%s'", %s, %s);
26 }
27 0 ▶ }, map { perlstring($_) } $field, $field, $class;
Subroutine __ANON__: called CC=2 SCAR=8.3
Subroutine __ANON__: not called CC=2 SCAR=8.3
Branch: 2 branches
BranchTrueFalseTotal
if @_ == 1 5 2 7
if @_ == 1 0 0 0
28 }
29  
30 7 ▶sub make_wo_accessor {
Subroutine make_wo_accessor: called CC=1 SCAR=0.0
Pod documented
31 7 my($class, $field) = @_;
32  
33 eval sprintf q{
34 sub {
35 if (@_ == 1) {
36 my $caller = caller;
37 $_[0]->_croak(sprintf "'$caller' cannot access the value of '%%s' on objects of class '%%s'", %s, %s);
38 }
39 else {
40 return $_[0]{%s} = $_[1] if @_ == 2;
41 return (shift)->{%s} = \@_;
42 }
43 }
44 0 ▶ }, map { perlstring($_) } $field, $class, $field, $field;
Subroutine __ANON__: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 4 branches
BranchTrueFalseTotal
if (@_ == 1) { } 1 3 4
if @_ == 2 2 1 3
if (@_ == 1) { } 1 1 2
if @_ == 2 1 0 1
45 }
46  
47 3 1;
48  
49 __END__
« Accessor/Faster.pm ↑ Summary