line |
stmt |
bran |
cond |
sub |
code |
1
|
|
|
|
|
package List::Objects::WithUtils::Array::Immutable; |
2
|
15
|
|
|
15
|
use strictures 1; |
|
15
|
|
|
|
|
|
15
|
|
|
|
|
3
|
|
|
|
|
|
4
|
|
|
|
|
require Role::Tiny; |
5
|
|
|
|
|
Role::Tiny->apply_roles_to_package( __PACKAGE__, |
6
|
|
|
|
|
qw/ |
7
|
|
|
|
|
List::Objects::WithUtils::Role::Array |
8
|
|
|
|
|
List::Objects::WithUtils::Role::Array::WithJunctions |
9
|
|
|
|
|
List::Objects::WithUtils::Role::Array::Immutable |
10
|
|
|
|
|
/, |
11
|
|
|
|
|
); |
12
|
|
|
|
|
|
13
|
15
|
|
|
15
|
use Exporter 'import'; |
|
15
|
|
|
|
|
|
15
|
|
|
|
|
14
|
|
|
|
|
our @EXPORT = 'immarray'; |
15
|
6
|
|
|
6
|
sub immarray { __PACKAGE__->new(@_) } |
16
|
|
|
|
|
|
17
|
|
|
|
|
1; |
18
|
|
|
|
|
|
19
|
|
|
|
|
=pod |
20
|
|
|
|
|
|
21
|
|
|
|
|
=head1 NAME |
22
|
|
|
|
|
|
23
|
|
|
|
|
List::Objects::WithUtils::Array::Immutable - Immutable array objects |
24
|
|
|
|
|
|
25
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
27
|
|
|
|
|
use List::Objects::WithUtils 'immarray'; |
28
|
|
|
|
|
|
29
|
|
|
|
|
my $array = immarray(qw/ a b c /); |
30
|
|
|
|
|
|
31
|
|
|
|
|
my ($head, $rest) = $array->head; |
32
|
|
|
|
|
|
33
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
35
|
|
|
|
|
These are immutable array objects; attempting to call list-mutating methods |
36
|
|
|
|
|
(or modify the backing array directly) will throw an exception. |
37
|
|
|
|
|
|
38
|
|
|
|
|
This class consumes the following roles, which contain most of the relevant |
39
|
|
|
|
|
documentation: |
40
|
|
|
|
|
|
41
|
|
|
|
|
L<List::Objects::WithUtils::Role::Array> |
42
|
|
|
|
|
|
43
|
|
|
|
|
L<List::Objects::WithUtils::Role::Array::WithJunctions> |
44
|
|
|
|
|
|
45
|
|
|
|
|
L<List::Objects::WithUtils::Role::Array::Immutable> |
46
|
|
|
|
|
|
47
|
|
|
|
|
(See L<List::Objects::WithUtils::Array> for a mutable implementation.) |
48
|
|
|
|
|
|
49
|
|
|
|
|
=head2 immarray |
50
|
|
|
|
|
|
51
|
|
|
|
|
Creates a new immutable array object. |
52
|
|
|
|
|
|
53
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
55
|
|
|
|
|
Jon Portnoy <avenj@cobaltirc.org> |
56
|
|
|
|
|
|
57
|
|
|
|
|
Licensed under the same terms as Perl. |
58
|
|
|
|
|
|
59
|
|
|
|
|
=cut |
60
|
|
|
|
|
|