| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
48
|
use 5.008; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
75
|
|
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
76
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
137
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Class::Accessor::Constructor::Base; |
|
6
|
|
|
|
|
|
|
BEGIN { |
|
7
|
2
|
|
|
2
|
|
27
|
$Class::Accessor::Constructor::Base::VERSION = '1.111590'; |
|
8
|
|
|
|
|
|
|
} |
|
9
|
|
|
|
|
|
|
# ABSTRACT: Support for an automated dirty flag in hash-based classes |
|
10
|
2
|
|
|
2
|
|
10
|
use Data::Inherited; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
26
|
|
|
11
|
2
|
|
|
2
|
|
2218
|
use Class::Accessor::Complex; |
|
|
2
|
|
|
|
|
29547
|
|
|
|
2
|
|
|
|
|
39
|
|
|
12
|
2
|
|
|
2
|
|
1959
|
use Tie::Hash; |
|
|
2
|
|
|
|
|
1655
|
|
|
|
2
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
|
|
our @ISA = qw(Tie::StdHash Data::Inherited Class::Accessor::Complex); |
|
14
|
|
|
|
|
|
|
__PACKAGE__ |
|
15
|
|
|
|
|
|
|
->mk_boolean_accessors(qw(dirty)) |
|
16
|
|
|
|
|
|
|
->mk_set_accessors(qw(hygienic unhygienic)); |
|
17
|
2
|
|
|
2
|
|
116
|
use constant HYGIENIC => ( qw(dirty hygienic unhygienic)); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
298
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# STORE() always gets called with this package as ref($self), not with the |
|
20
|
|
|
|
|
|
|
# original class. So we rely on constructor_with_dirty telling us what the |
|
21
|
|
|
|
|
|
|
# original class was in order to determine whether or not a key should cause |
|
22
|
|
|
|
|
|
|
# the dirty flag to be set. |
|
23
|
|
|
|
|
|
|
# Every accessor in an object causes the object's dirty flag to be set, except |
|
24
|
|
|
|
|
|
|
# those mentioned in HYGIENIC. If you want only one or a few accessors to use |
|
25
|
|
|
|
|
|
|
# the dirty flag and don't want to list all the other ones in HYGIENIC, we |
|
26
|
|
|
|
|
|
|
# have an UNHYGIENIC list, just like HYGIENIC. It is also set from within |
|
27
|
|
|
|
|
|
|
# constructor_with_dirty. In STORE(), we check whether there the unhygienic |
|
28
|
|
|
|
|
|
|
# list is non-empty. If so, only dirty the object with keys from that list. |
|
29
|
|
|
|
|
|
|
# Otherwise check hygienic. That is, UNHYGIENIC supersedes HYGIENIC. Obviously |
|
30
|
|
|
|
|
|
|
# it doesn't make sense to have both in an object. The mechanism is similar to |
|
31
|
|
|
|
|
|
|
# Apache's allow/deny. |
|
32
|
|
|
|
|
|
|
sub STORE { |
|
33
|
9
|
|
|
9
|
|
4224
|
my ($self, $key, $value) = @_; |
|
34
|
9
|
50
|
|
|
|
25
|
if ($self->size_unhygienic > 0) { |
|
35
|
0
|
0
|
|
|
|
0
|
$self->set_dirty if $self->unhygienic_contains($key); |
|
36
|
|
|
|
|
|
|
} else { |
|
37
|
9
|
100
|
|
|
|
84
|
$self->set_dirty unless $self->hygienic_contains($key); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
9
|
|
|
|
|
127
|
$self->{$key} = $value; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |