line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Native::Attribute::ReadOnlyHash; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
26577
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
134
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
57
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
736
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
11
|
|
|
11
|
0
|
6136
|
my $old = shift; |
9
|
11
|
50
|
0
|
|
|
38
|
$old = tied ( %$old ) // $old if ref $old; |
10
|
11
|
|
33
|
|
|
53
|
my $class = ref $old || $old; |
11
|
11
|
|
|
|
|
18
|
my $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
11
|
|
|
|
|
14
|
my $hash; |
14
|
11
|
|
|
|
|
56
|
tie %$hash, $class, $self; |
15
|
11
|
|
|
|
|
25
|
bless $hash, $class; |
16
|
11
|
|
|
|
|
62
|
return $hash; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub TIEHASH { |
20
|
11
|
|
|
11
|
|
15
|
my $old = shift; |
21
|
11
|
|
33
|
|
|
49
|
my $class = ref $old || $old; |
22
|
11
|
|
50
|
|
|
31
|
my $data = shift || {}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Do not bless the reference that is passed in; the whole point is |
25
|
|
|
|
|
|
|
# not to modify the underlying data |
26
|
11
|
|
|
|
|
17
|
my $self = \$data; |
27
|
11
|
|
|
|
|
29
|
bless $self, $class; |
28
|
|
|
|
|
|
|
|
29
|
11
|
|
|
|
|
36
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub FETCH { |
33
|
10
|
|
|
10
|
|
1054
|
my $self = shift; |
34
|
10
|
|
|
|
|
19
|
my $key = shift; |
35
|
|
|
|
|
|
|
|
36
|
10
|
|
|
|
|
44
|
return $$self->{$key}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub STORE { |
40
|
6
|
|
|
6
|
|
2352
|
my $self = shift; |
41
|
6
|
|
|
|
|
10
|
my $key = shift; |
42
|
6
|
|
|
|
|
12
|
my $value = shift; |
43
|
|
|
|
|
|
|
|
44
|
6
|
|
|
|
|
88
|
croak "Cannot modify read-only hash"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub DELETE { |
48
|
2
|
|
|
2
|
|
1122
|
my $self = shift; |
49
|
2
|
|
|
|
|
5
|
my $key = shift; |
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
24
|
croak "Cannot modify read-only hash"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub CLEAR { |
55
|
1
|
|
|
1
|
|
37
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
14
|
croak "Cannot modify read-only hash"; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub EXISTS { |
61
|
4
|
|
|
4
|
|
40
|
my $self = shift; |
62
|
4
|
|
|
|
|
6
|
my $key = shift; |
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
|
|
20
|
return exists $$self->{$key}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub FIRSTKEY { |
68
|
4
|
|
|
4
|
|
2484
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
9
|
keys %$$self; |
71
|
4
|
|
|
|
|
20
|
return each %$$self; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub NEXTKEY { |
75
|
8
|
|
|
8
|
|
2195
|
my $self = shift; |
76
|
|
|
|
|
|
|
|
77
|
8
|
|
|
|
|
44
|
return each %$$self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub SCALAR { |
81
|
2
|
|
|
2
|
|
8
|
my $self = shift; |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
13
|
return scalar %$$self; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |