File Coverage

blib/lib/List/Objects/WithUtils/Array/Immutable.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::Array::Immutable;
2             $List::Objects::WithUtils::Array::Immutable::VERSION = '2.028003';
3 99     99   1090 use strictures 2;
  99         436  
  99         3103  
4              
5             require Role::Tiny;
6             Role::Tiny->apply_roles_to_package( __PACKAGE__,
7             qw/
8             List::Objects::WithUtils::Role::Array
9             List::Objects::WithUtils::Role::Array::WithJunctions
10             List::Objects::WithUtils::Role::Array::Immutable
11             /,
12             );
13              
14 99     99   14840 use Exporter ();
  99         116  
  99         4067  
15             our @EXPORT = 'immarray';
16              
17             sub import {
18 99     99   193 my $pkg = caller;
19 99     99   449 { no strict 'refs';
  99         107  
  99         11022  
  99         105  
20 99         140 ${"${pkg}::a"} = ${"${pkg}::a"};
  99         159  
  99         276  
21 99         93 ${"${pkg}::b"} = ${"${pkg}::b"};
  99         147  
  99         174  
22             }
23 99         5118 goto &Exporter::import
24             }
25              
26 7     7 1 1346 sub immarray { __PACKAGE__->new(@_) }
27              
28             1;
29              
30             =pod
31              
32             =head1 NAME
33              
34             List::Objects::WithUtils::Array::Immutable - Immutable array objects
35              
36             =head1 SYNOPSIS
37              
38             use List::Objects::WithUtils 'immarray';
39              
40             my $array = immarray(qw/ a b c /);
41              
42             my ($head, $rest) = $array->head;
43              
44             =head1 DESCRIPTION
45              
46             These are immutable array objects; attempting to call list-mutating methods
47             (or modify the backing array directly) will throw an exception.
48              
49             This class consumes the following roles, which contain most of the relevant
50             documentation:
51              
52             L
53              
54             L
55              
56             L
57              
58             (See L for a mutable implementation.)
59              
60             =head2 immarray
61              
62             Creates a new immutable array object.
63              
64             =head1 AUTHOR
65              
66             Jon Portnoy
67              
68             Licensed under the same terms as Perl.
69              
70             =cut