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.028003'; |
3
|
98
|
|
|
98
|
|
1112
|
use strictures 2; |
|
98
|
|
|
|
|
444
|
|
|
98
|
|
|
|
|
3208
|
|
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
|
|
14721
|
use Exporter (); |
|
98
|
|
|
|
|
124
|
|
|
98
|
|
|
|
|
4156
|
|
15
|
|
|
|
|
|
|
our @EXPORT = 'immhash_of'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
18
|
98
|
|
|
98
|
|
175
|
my $pkg = caller; |
19
|
98
|
|
|
98
|
|
343
|
{ no strict 'refs'; |
|
98
|
|
|
|
|
154
|
|
|
98
|
|
|
|
|
10629
|
|
|
98
|
|
|
|
|
99
|
|
20
|
98
|
|
|
|
|
95
|
${"${pkg}::a"} = ${"${pkg}::a"}; ${"${pkg}::b"} = ${"${pkg}::b"}; |
|
98
|
|
|
|
|
175
|
|
|
98
|
|
|
|
|
351
|
|
|
98
|
|
|
|
|
156
|
|
|
98
|
|
|
|
|
139
|
|
|
98
|
|
|
|
|
166
|
|
21
|
|
|
|
|
|
|
} |
22
|
98
|
|
|
|
|
5029
|
goto &Exporter::import |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
2
|
1
|
415
|
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 |