| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package List::Objects::WithUtils::Hash::Immutable::Typed; |
|
2
|
|
|
|
|
|
|
$List::Objects::WithUtils::Hash::Immutable::Typed::VERSION = '2.028002'; |
|
3
|
98
|
|
|
98
|
|
1120
|
use strictures 2; |
|
|
98
|
|
|
|
|
433
|
|
|
|
98
|
|
|
|
|
3280
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Role::Tiny; |
|
6
|
|
|
|
|
|
|
Role::Tiny->apply_roles_to_package( __PACKAGE__, |
|
7
|
|
|
|
|
|
|
qw/ |
|
8
|
|
|
|
|
|
|
List::Objects::WithUtils::Role::Hash |
|
9
|
|
|
|
|
|
|
List::Objects::WithUtils::Role::Hash::Typed |
|
10
|
|
|
|
|
|
|
List::Objects::WithUtils::Role::Hash::Immutable |
|
11
|
|
|
|
|
|
|
/ |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
98
|
|
|
98
|
|
15332
|
use Exporter (); |
|
|
98
|
|
|
|
|
124
|
|
|
|
98
|
|
|
|
|
4333
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT = 'immhash_of'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
|
18
|
98
|
|
|
98
|
|
190
|
my $pkg = caller; |
|
19
|
98
|
|
|
98
|
|
396
|
{ no strict 'refs'; |
|
|
98
|
|
|
|
|
128
|
|
|
|
98
|
|
|
|
|
11276
|
|
|
|
98
|
|
|
|
|
118
|
|
|
20
|
98
|
|
|
|
|
97
|
${"${pkg}::a"} = ${"${pkg}::a"}; ${"${pkg}::b"} = ${"${pkg}::b"}; |
|
|
98
|
|
|
|
|
218
|
|
|
|
98
|
|
|
|
|
410
|
|
|
|
98
|
|
|
|
|
94
|
|
|
|
98
|
|
|
|
|
151
|
|
|
|
98
|
|
|
|
|
186
|
|
|
21
|
|
|
|
|
|
|
} |
|
22
|
98
|
|
|
|
|
5553
|
goto &Exporter::import |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
2
|
|
|
2
|
1
|
246
|
sub immhash_of { __PACKAGE__->new(@_) } |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
List::Objects::WithUtils::Hash::Immutable::Typed - Immutable typed hashes |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use List::Objects::WithUtils 'immhash_of'; |
|
38
|
|
|
|
|
|
|
use Types::Standard -types; |
|
39
|
|
|
|
|
|
|
my $hash = immhash_of Int() => ( foo => 1, bar => 2 ); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
These are immutable type-checking hash objects, essentially a combination of |
|
44
|
|
|
|
|
|
|
L and |
|
45
|
|
|
|
|
|
|
L. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Type-checking is performed when |
|
48
|
|
|
|
|
|
|
the object is created; attempts to modify the object will throw an exception. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This class consumes the following roles, which contain most of the relevant |
|
51
|
|
|
|
|
|
|
documentation: |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 immhash_of |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Creates a new immutable typed hash object. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Jon Portnoy |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |