line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Smoke::ObjectBase; |
2
|
46
|
|
|
46
|
|
220785
|
use warnings; |
|
46
|
|
|
|
|
122
|
|
|
46
|
|
|
|
|
1594
|
|
3
|
46
|
|
|
46
|
|
256
|
use strict; |
|
46
|
|
|
|
|
87
|
|
|
46
|
|
|
|
|
1019
|
|
4
|
46
|
|
|
46
|
|
247
|
use Carp qw/ confess /; |
|
46
|
|
|
|
|
113
|
|
|
46
|
|
|
|
|
10236
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub AUTOLOAD { |
24
|
98528
|
|
|
98528
|
|
148022
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
98528
|
|
|
|
|
261314
|
(my $attrib = our $AUTOLOAD) =~ s/.*:://; |
27
|
98528
|
100
|
|
|
|
223195
|
if (exists $self->{"_$attrib"}) { |
28
|
98527
|
100
|
|
|
|
161684
|
$self->{"_$attrib"} = shift if @_; |
29
|
98527
|
|
|
|
|
307391
|
return $self->{"_$attrib"}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
confess( |
32
|
1
|
|
|
|
|
222
|
sprintf( |
33
|
|
|
|
|
|
|
"Invalid attribute '%s' for class '%s'", |
34
|
|
|
|
|
|
|
$attrib, |
35
|
|
|
|
|
|
|
ref($self) |
36
|
|
|
|
|
|
|
) |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
908
|
|
|
908
|
|
36377
|
sub DESTROY { 1 } # the 1 is for coverage |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |