lib/Test/Smoke/ObjectBase.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 27 / 27 CC 3 SCAR 6.2
CC
3
Cov
100%
AUTOLOAD
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« blib/script/tsw32configure.pl ↑ Summary blib/lib/Test/Smoke/App/HandleQueue.pm »
1 package Test::Smoke::ObjectBase;
2 53 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 53 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 53 ▶use Carp qw/ confess /;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 53 our $VERSION = '0.001';
7  
8 =head1 NAME
9  
10 Test::Smoke:ObjectBase - Base class for objects (AUTOLOADed accessors)
11  
12 =head1 DESCRIPTION
13  
14 This base class provides accessors via AUTOLOAD for hashkeys that start with
15 an underscore.
16  
17 $self->{_name} gives $self->name()
18  
19 The accessors are 'getters' as well as 'setters'.
20  
21 =cut
22  
23 111369 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=11.0
24 111369 my $self = shift;
25  
26 111369 (my $attrib = our $AUTOLOAD) =~ s/.*:://;
27 111369 ▶ if (exists $self->{"_$attrib"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$self{"_$attrib"}) 111368 1 111369
28 111368 ▶ $self->{"_$attrib"} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 73 111295 111368
29 111368 return $self->{"_$attrib"};
30 }
31 confess(
32 1 sprintf(
33 "Invalid attribute '%s' for class '%s'",
34 $attrib,
35 ref($self)
36 )
37 );
38 }
39  
40 1018 ▶sub DESTROY { 1 } # the 1 is for coverage
Subroutine DESTROY: called CC=1 SCAR=0.0
41  
42 53 1;
« blib/script/tsw32configure.pl ↑ Summary blib/lib/Test/Smoke/App/HandleQueue.pm »