line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Variable::Strongly::Typed::Hash; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
40
|
use version; $VERSION = qv('1.0.0'); |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
501
|
use warnings; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
183
|
|
6
|
7
|
|
|
7
|
|
35
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
188
|
|
7
|
7
|
|
|
7
|
|
37
|
use Carp; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
510
|
|
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
35
|
use base qw(Variable::Strongly::Typed); |
|
7
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
4565
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
{ |
12
|
|
|
|
|
|
|
sub TIEHASH { |
13
|
1
|
|
|
1
|
|
2
|
my($class, $type) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
6
|
my $self = bless \my($anon_scalar), $class; |
16
|
1
|
|
|
|
|
11
|
$self->_init({}, $type); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub STORE { |
20
|
0
|
|
|
0
|
|
|
my($self, $key, $value) = @_; |
21
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$self->_check_values($value); |
24
|
0
|
|
|
|
|
|
$hash->{$key} = $value; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub FETCH { |
28
|
0
|
|
|
0
|
|
|
my($self, $key) = @_; |
29
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
30
|
0
|
|
|
|
|
|
$hash->{$key}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub FIRSTKEY { |
34
|
0
|
|
|
0
|
|
|
my($self) = @_; |
35
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
36
|
0
|
|
|
|
|
|
my $a = scalar keys %{$hash}; |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
each %{$hash}; |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub NEXTKEY { |
41
|
0
|
|
|
0
|
|
|
my($self) = @_; |
42
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
43
|
0
|
|
|
|
|
|
each %{$hash}; |
|
0
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub EXISTS { |
47
|
0
|
|
|
0
|
|
|
my($self, $key) = @_; |
48
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
49
|
0
|
|
|
|
|
|
exists $hash->{$key}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub DELETE { |
53
|
0
|
|
|
0
|
|
|
my($self, $key) = @_; |
54
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
55
|
0
|
|
|
|
|
|
delete $hash->{$key}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub CLEAR { |
59
|
0
|
|
|
0
|
|
|
my($self) = @_; |
60
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
61
|
0
|
|
|
|
|
|
%{$hash} = () |
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub SCALAR { |
65
|
0
|
|
|
0
|
|
|
my($self) = @_; |
66
|
0
|
|
|
|
|
|
my $hash = $self->_get_object; |
67
|
0
|
|
|
|
|
|
scalar %{$hash}; |
|
0
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |