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