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