File Coverage

lib/List/Objects/WithUtils/Hash/Immutable.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
total 10 10 100.0


line stmt bran cond sub code
1         package List::Objects::WithUtils::Hash::Immutable;
2 14     14 use strictures 1;
  14        
  14        
3          
4         require Role::Tiny;
5         Role::Tiny->apply_roles_to_package( __PACKAGE__,
6           qw/
7         List::Objects::WithUtils::Role::Hash
8         List::Objects::WithUtils::Role::Hash::Immutable
9         /,
10         );
11          
12 14     14 use Exporter 'import';
  14        
  14        
13         our @EXPORT = 'immhash';
14 3     3 sub immhash { __PACKAGE__->new(@_) }
15          
16         1;
17          
18         =pod
19        
20         =head1 NAME
21        
22         List::Objects::WithUtils::Hash::Immutable - Immutable hash objects
23        
24         =head1 SYNOPSIS
25        
26         use List::Objects::WithUtils 'immhash';
27         my $hash = immhash( foo => 1, bar => 2 );
28        
29         =head1 DESCRIPTION
30        
31         These are immutable hash objects; attempting to call list-mutating methods
32         (or modify the backing hash directly) will throw an exception.
33        
34         This class consumes the following roles, which contain most of the relevant
35         documentation:
36        
37         L<List::Objects::WithUtils::Role::Hash>
38        
39         L<List::Objects::WithUtils::Role::Hash::Immutable>
40        
41         (See L<List::Objects::WithUtils::Hash> for a mutable implementation.)
42        
43         =head2 immhash
44        
45         Creates a new immutable hash object.
46        
47         =head1 AUTHOR
48        
49         Jon Portnoy <avenj@cobaltirc.org>
50        
51         =cut
52