line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Property::RO::Lazy;
|
2
|
1
|
|
|
1
|
|
6
|
use strict; use warnings FATAL => 'all';
|
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
3
|
1
|
|
|
1
|
|
7
|
use parent 'Class::Property::RO';
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub TIESCALAR
|
6
|
|
|
|
|
|
|
{
|
7
|
1
|
|
|
1
|
|
3
|
my( $class, $field, $init, $flag_ref ) = @_;
|
8
|
1
|
|
|
|
|
5
|
return bless {
|
9
|
|
|
|
|
|
|
'field' => $field
|
10
|
|
|
|
|
|
|
, 'init' => $init
|
11
|
|
|
|
|
|
|
, 'flag_ref' => $flag_ref
|
12
|
|
|
|
|
|
|
}, $class;
|
13
|
|
|
|
|
|
|
}
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub FETCH
|
16
|
|
|
|
|
|
|
{
|
17
|
4
|
|
|
4
|
|
50
|
my( $self ) = @_;
|
18
|
|
|
|
|
|
|
|
19
|
4
|
100
|
|
|
|
16
|
if( not defined $self->{'flag_ref'}->{$self->{'object'}} )
|
20
|
|
|
|
|
|
|
{
|
21
|
2
|
|
|
|
|
5
|
$self->{'flag_ref'}->{$self->{'object'}} = $self->{'object'};
|
22
|
2
|
|
|
|
|
7
|
Scalar::Util::weaken($self->{'flag_ref'}->{$self->{'object'}});
|
23
|
2
|
|
|
|
|
8
|
$self->{'object'}->{$self->{'field'}} = $self->{'init'}->($self->{'object'});
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
21
|
return $self->{'object'}->{$self->{'field'}};
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |