Coverage Summary

# File Coverage

lib/List/Objects/WithUtils/Hash/Typed.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::Typed;
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::Typed
9 |  |  |  |  | /
10 |  |  |  |  | );
11 |  |  |  |  |
12 | 14 |  |  | 14 | use Exporter 'import';
| 14 |  |  |  |
| 14 |  |  |  |
13 |  |  |  |  | our @EXPORT = 'hash_of';
14 | 3 |  |  | 3 | sub hash_of { __PACKAGE__->new(@_) }
15 |  |  |  |  |
16 |  |  |  |  | 1;
17 |  |  |  |  |
18 |  |  |  |  |
19 |  |  |  |  | =pod
20 |  |  |  |  |
21 |  |  |  |  | =head1 NAME
22 |  |  |  |  |
23 |  |  |  |  | List::Objects::WithUtils::Hash::Typed - Type-checking hash objects
24 |  |  |  |  |
25 |  |  |  |  | =head1 SYNOPSIS
26 |  |  |  |  |
27 |  |  |  |  | use List::Objects::WithUtils 'hash_of';
28 |  |  |  |  |
29 |  |  |  |  | use Types::Standard -all;
30 |  |  |  |  |
31 |  |  |  |  | my $arr = hash_of Int() => ( foo => 1, bar => 2 );
32 |  |  |  |  |
33 |  |  |  |  | =head1 DESCRIPTION
34 |  |  |  |  |
35 |  |  |  |  | These are type-checking hash objects; values are checked against the specified
36 |  |  |  |  | type when the object is constructed or new elements are added.
37 |  |  |  |  |
38 |  |  |  |  | The first argument passed to the constructor should be a L<Type::Tiny> type:
39 |  |  |  |  |
40 |  |  |  |  | use Types::Standard -all;
41 |  |  |  |  | my $hash = hash_of Int() => ( foo => 1 );
42 |  |  |  |  |
43 |  |  |  |  | If the initial type-check fails, a coercion is attempted.
44 |  |  |  |  |
45 |  |  |  |  | This class consumes the following roles, which contain most of the relevant
46 |  |  |  |  | documentation:
47 |  |  |  |  |
48 |  |  |  |  | L<List::Objects::WithUtils::Role::Hash>
49 |  |  |  |  |
50 |  |  |  |  | L<List::Objects::WithUtils::Role::Hash::Typed>
51 |  |  |  |  |
52 |  |  |  |  | Also see L<Types::Standard>, L<List::Objects::Types>
53 |  |  |  |  |
54 |  |  |  |  | =head2 hash_of
55 |  |  |  |  |
56 |  |  |  |  | Creates a new typed hash object.
57 |  |  |  |  |
58 |  |  |  |  | =head1 AUTHOR
59 |  |  |  |  |
60 |  |  |  |  | Jon Portnoy <avenj@cobaltirc.org> with significant contributions from Toby
61 |  |  |  |  | Inkster (CPAN: TOBYINK)
62 |  |  |  |  |
63 |  |  |  |  | =cut
64 |  |  |  |  |