line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Accessor::Lazy::Original;
|
2
|
1
|
|
|
1
|
|
5
|
use strict; use warnings FATAL => 'all';
|
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
53
|
|
3
|
1
|
|
|
1
|
|
7
|
use Exporter 'import';
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
112
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.000';
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT;
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
push @EXPORT, 'original_accessors';
|
10
|
|
|
|
|
|
|
sub original_accessors{
|
11
|
1
|
|
|
1
|
0
|
2
|
my $self = shift;
|
12
|
1
|
|
33
|
|
|
23
|
my $class = ref $self || $self;
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
no strict 'refs';
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
679
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
3
|
*{"${class}::make_accessor"} = \&Class::Accessor::make_accessor;
|
|
1
|
|
|
|
|
4
|
|
17
|
1
|
|
|
|
|
2
|
*{"${class}::make_ro_accessor"} = \&Class::Accessor::make_ro_accessor;
|
|
1
|
|
|
|
|
4
|
|
18
|
1
|
|
|
|
|
2
|
*{"${class}::make_wo_accessor"} = \&Class::Accessor::make_wo_accessor;
|
|
1
|
|
|
|
|
4
|
|
19
|
1
|
|
|
|
|
2
|
*{"${class}::make_lazy_accessor"} = \&Class::Accessor::Lazy::Original::make_accessor;
|
|
1
|
|
|
|
|
9
|
|
20
|
1
|
|
|
|
|
3
|
*{"${class}::make_lazy_ro_accessor"} = \&Class::Accessor::Lazy::Original::make_ro_accessor;
|
|
1
|
|
|
|
|
4
|
|
21
|
1
|
|
|
|
|
1
|
*{"${class}::make_lazy_wo_accessor"} = \&Class::Accessor::Lazy::Original::make_wo_accessor;
|
|
1
|
|
|
|
|
4
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
8
|
return $self;
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub make_accessor {
|
27
|
0
|
|
|
0
|
0
|
0
|
my ($class, $field) = @_;
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return sub {
|
30
|
0
|
|
|
0
|
|
0
|
my $self = shift;
|
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
0
|
if(@_)
|
33
|
|
|
|
|
|
|
{
|
34
|
0
|
0
|
|
|
|
0
|
$self->{'__lazy_inits'}->{$field} = 1 unless exists $self->{'__lazy_inits'}->{$field};
|
35
|
0
|
|
|
|
|
0
|
return $self->set($field, @_);
|
36
|
|
|
|
|
|
|
}
|
37
|
|
|
|
|
|
|
else
|
38
|
|
|
|
|
|
|
{
|
39
|
0
|
0
|
|
|
|
0
|
unless (exists $self->{'__lazy_inits'}->{$field})
|
40
|
|
|
|
|
|
|
{
|
41
|
0
|
|
|
|
|
0
|
my $init_method = "_lazy_init_$field";
|
42
|
0
|
|
|
|
|
0
|
$self->$init_method();
|
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
$self->{'__lazy_inits'}->{$field} = 1;
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
return $self->get($field);
|
48
|
|
|
|
|
|
|
}
|
49
|
0
|
|
|
|
|
0
|
};
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub make_ro_accessor {
|
53
|
2
|
|
|
2
|
0
|
3
|
my($class, $field) = @_;
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
return sub {
|
56
|
8
|
|
|
8
|
|
6445
|
my $self = shift;
|
57
|
|
|
|
|
|
|
|
58
|
8
|
50
|
|
|
|
16
|
if (@_)
|
59
|
|
|
|
|
|
|
{
|
60
|
0
|
|
|
|
|
0
|
my $caller = caller;
|
61
|
0
|
|
|
|
|
0
|
$self->_croak("'$caller' cannot alter the value of '$field' on objects of class '$class'");
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
else
|
64
|
|
|
|
|
|
|
{
|
65
|
8
|
100
|
|
|
|
20
|
if (not exists $self->{'__lazy_inits'}->{$field})
|
66
|
|
|
|
|
|
|
{
|
67
|
4
|
|
|
|
|
9
|
my $init_method = "_lazy_init_$field";
|
68
|
4
|
|
|
|
|
12
|
$self->$init_method();
|
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
18
|
$self->{'__lazy_inits'}->{$field} = 1;
|
71
|
|
|
|
|
|
|
}
|
72
|
8
|
|
|
|
|
18
|
return $self->get($field);
|
73
|
|
|
|
|
|
|
}
|
74
|
2
|
|
|
|
|
8
|
};
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# requires only for best_practice rw acessors
|
78
|
|
|
|
|
|
|
sub make_wo_accessor {
|
79
|
1
|
|
|
1
|
0
|
2
|
my($class, $field) = @_;
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return sub {
|
82
|
2
|
|
|
2
|
|
538
|
my $self = shift;
|
83
|
|
|
|
|
|
|
|
84
|
2
|
50
|
|
|
|
6
|
unless (@_)
|
85
|
|
|
|
|
|
|
{
|
86
|
0
|
|
|
|
|
0
|
my $caller = caller;
|
87
|
0
|
|
|
|
|
0
|
$self->_croak("'$caller' cannot access the value of '$field' on objects of class '$class'");
|
88
|
|
|
|
|
|
|
}
|
89
|
|
|
|
|
|
|
else
|
90
|
|
|
|
|
|
|
{
|
91
|
2
|
50
|
|
|
|
8
|
$self->{'__lazy_inits'}->{$field} = 1 unless exists $self->{'__lazy_inits'}->{$field};
|
92
|
2
|
|
|
|
|
6
|
return $self->set($field, @_);
|
93
|
|
|
|
|
|
|
}
|
94
|
1
|
|
|
|
|
4
|
};
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |