| 1 | package List::Objects::WithUtils::Hash::Immutable::Typed; | ||
| 2 | 98 | $List::Objects::WithUtils::Hash::Immutable::Typed::VERSION = '2.028002'; | |
| 3 | 98 | ▶ | use strictures 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 98 | require Role::Tiny; | |
| 6 | 98 | 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 | ▶ | use Exporter (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 98 | our @EXPORT = 'immhash_of'; | |
| 16 | |||
| 17 | sub import { | ||
| 18 | 98 | ▶ | my $pkg = caller; |
|
Subroutine
import: called CC=1 SCAR=0.0
| |||
| 19 | 98 | ▶ | { no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 98 | ${"${pkg}::a"} = ${"${pkg}::a"}; ${"${pkg}::b"} = ${"${pkg}::b"}; | |
| 21 | } | ||
| 22 | 98 | goto &Exporter::import | |
| 23 | } | ||
| 24 | |||
| 25 | 0 | ▶ | sub immhash_of { __PACKAGE__->new(@_) } |
|
Subroutine
immhash_of: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | |||
| 27 | 98 | 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<List::Objects::WithUtils::Hash::Typed> and | ||
| 45 | L<List::Objects::WithUtils::Hash::Immutable>. | ||
| 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<List::Objects::WithUtils::Role::Hash> | ||
| 54 | |||
| 55 | L<List::Objects::WithUtils::Role::Hash::Typed> | ||
| 56 | |||
| 57 | L<List::Objects::WithUtils::Role::Hash::Immutable> | ||
| 58 | |||
| 59 | =head2 immhash_of | ||
| 60 | |||
| 61 | Creates a new immutable typed hash object. | ||
| 62 | |||
| 63 | =head1 AUTHOR | ||
| 64 | |||
| 65 | Jon Portnoy <avenj@cobaltirc.org> | ||
| 66 | |||
| 67 | =cut | ||