List/Objects/WithUtils/Hash/Immutable.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 93.3% 28 / 30 SCAR 0.0
CC
1
Cov
96%
immhash
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« List/Objects/WithUtils/Array/Immutable/Typed.pm ↑ Summary List/Objects/WithUtils/Hash/Immutable/Typed.pm »
1 package List::Objects::WithUtils::Hash::Immutable;
2 98 $List::Objects::WithUtils::Hash::Immutable::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::Immutable
10 /,
11 );
12  
13 98 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 98 our @EXPORT = 'immhash';
15  
16 sub import {
17 98 ▶ my $pkg = caller;
Subroutine import: called CC=1 SCAR=0.0
18 98 ▶ { no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 98 ${"${pkg}::a"} = ${"${pkg}::a"}; ${"${pkg}::b"} = ${"${pkg}::b"};
20 }
21 98 goto &Exporter::import
22 }
23  
24 0 ▶sub immhash { __PACKAGE__->new(@_) }
Subroutine immhash: not called CC=1 SCAR=6.9
Pod documented
25  
26 98 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<List::Objects::WithUtils::Role::Hash>
48  
49 L<List::Objects::WithUtils::Role::Hash::Immutable>
50  
51 (See L<List::Objects::WithUtils::Hash> for a mutable implementation.)
52  
53 =head2 immhash
54  
55 Creates a new immutable hash object.
56  
57 =head1 AUTHOR
58  
59 Jon Portnoy <avenj@cobaltirc.org>
60  
61 =cut
« List/Objects/WithUtils/Array/Immutable/Typed.pm ↑ Summary List/Objects/WithUtils/Hash/Immutable/Typed.pm »