line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package List::Objects::WithUtils::Hash::Immutable; |
2
|
|
|
|
|
|
|
$List::Objects::WithUtils::Hash::Immutable::VERSION = '2.028002'; |
3
|
98
|
|
|
98
|
|
1069
|
use strictures 2; |
|
98
|
|
|
|
|
445
|
|
|
98
|
|
|
|
|
3406
|
|
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::Immutable |
10
|
|
|
|
|
|
|
/, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
98
|
|
|
98
|
|
15255
|
use Exporter (); |
|
98
|
|
|
|
|
178
|
|
|
98
|
|
|
|
|
4168
|
|
14
|
|
|
|
|
|
|
our @EXPORT = 'immhash'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub import { |
17
|
98
|
|
|
98
|
|
186
|
my $pkg = caller; |
18
|
98
|
|
|
98
|
|
384
|
{ no strict 'refs'; |
|
98
|
|
|
|
|
114
|
|
|
98
|
|
|
|
|
10942
|
|
|
98
|
|
|
|
|
112
|
|
19
|
98
|
|
|
|
|
100
|
${"${pkg}::a"} = ${"${pkg}::a"}; ${"${pkg}::b"} = ${"${pkg}::b"}; |
|
98
|
|
|
|
|
307
|
|
|
98
|
|
|
|
|
366
|
|
|
98
|
|
|
|
|
144
|
|
|
98
|
|
|
|
|
159
|
|
|
98
|
|
|
|
|
152
|
|
20
|
|
|
|
|
|
|
} |
21
|
98
|
|
|
|
|
5227
|
goto &Exporter::import |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
1
|
86
|
sub immhash { __PACKAGE__->new(@_) } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
List::Objects::WithUtils::Hash::Immutable - Immutable hash objects |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use List::Objects::WithUtils 'immhash'; |
37
|
|
|
|
|
|
|
my $hash = immhash( foo => 1, bar => 2 ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
These are immutable hash objects; attempting to call list-mutating methods |
42
|
|
|
|
|
|
|
(or modify the backing hash directly) will throw an exception. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This class consumes the following roles, which contain most of the relevant |
45
|
|
|
|
|
|
|
documentation: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
L |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
L |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
(See L for a mutable implementation.) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 immhash |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Creates a new immutable hash object. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Jon Portnoy |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |