File Coverage

blib/lib/List/Objects/WithUtils/Hash/Immutable/Typed.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


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.027002';
3 98     98   1925 use strictures 2;
  98         614  
  98         4347  
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   23216 use Exporter ();
  98         255  
  98         5164  
15             our @EXPORT = 'immhash_of';
16              
17             sub import {
18 98     98   264 my $pkg = caller;
19 98     98   618 { no strict 'refs';
  98         189  
  98         14861  
  98         198  
20 98         172 ${"${pkg}::a"} = ${"${pkg}::a"}; ${"${pkg}::b"} = ${"${pkg}::b"};
  98         314  
  98         567  
  98         247  
  98         278  
  98         287  
21             }
22 98         7019 goto &Exporter::import
23             }
24              
25 2     2 1 328 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