List/Objects/WithUtils/Array/Immutable.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
import
1.0
CRAP 1.0
« List/Objects/WithUtils/Array.pm ↑ Summary List/Objects/WithUtils/Hash/Typed.pm »
1 package List::Objects::WithUtils::Array::Immutable;
2 93 $List::Objects::WithUtils::Array::Immutable::VERSION = '2.028002';
3 99 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 93 require Role::Tiny;
6 93 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 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 93 our @EXPORT = 'immarray';
16  
17 sub import {
18 93 ▶ my $pkg = caller;
Subroutine import: called CC=1 SCAR=0.0
19 99 ▶ { no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 93 ${"${pkg}::a"} = ${"${pkg}::a"};
21 93 ${"${pkg}::b"} = ${"${pkg}::b"};
22 }
23 93 goto &Exporter::import
24 }
25  
26 6 ▶sub immarray { __PACKAGE__->new(@_) }
Subroutine immarray: called CC=1 SCAR=0.0
Pod documented
27  
28 93 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<List::Objects::WithUtils::Role::Array>
53  
54 L<List::Objects::WithUtils::Role::Array::WithJunctions>
55  
56 L<List::Objects::WithUtils::Role::Array::Immutable>
57  
58 (See L<List::Objects::WithUtils::Array> for a mutable implementation.)
59  
60 =head2 immarray
61  
62 Creates a new immutable array object.
63  
64 =head1 AUTHOR
65  
66 Jon Portnoy <avenj@cobaltirc.org>
67  
68 Licensed under the same terms as Perl.
69  
70 =cut
« List/Objects/WithUtils/Array.pm ↑ Summary List/Objects/WithUtils/Hash/Typed.pm »