1Moose::Autobox::Array(3U)ser Contributed Perl DocumentatiMoonose::Autobox::Array(3)
2
3
4

NAME

6       Moose::Autobox::Array - the Array role
7

VERSION

9       version 0.16
10

SYNOPSIS

12         use Moose::Autobox;
13
14         [ 1..5 ]->isa('ARRAY'); # true
15         [ a..z ]->does('Moose::Autobox::Array'); # true
16         [ 0..2 ]->does('Moose::Autobox::List'); # true
17
18         print "Squares: " . [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
19
20         print [ 1, 'number' ]->sprintf('%d is the loneliest %s');
21
22         print ([ 1 .. 5 ]->any == 3) ? 'true' : 'false'; # prints 'true'
23

DESCRIPTION

25       This is a role to describe operations on the Array type.
26

METHODS

28       "pop"
29       "push ($value)"
30       "shift"
31       "unshift ($value)"
32       "delete ($index)"
33       "sprintf ($format_string)"
34       "slice (@indices)"
35       "flatten"
36       "flatten_deep ($depth)"
37       "first"
38       "last"
39
40   Indexed implementation
41       "at ($index)"
42       "put ($index, $value)"
43       "exists ($index)"
44       "keys"
45       "values"
46       "kv"
47       "each"
48       "each_key"
49       "each_value"
50       "each_n_values ($n, $callback)"
51
52   List implementation
53       "head"
54       "tail"
55       "join (?$seperator)"
56       "length"
57       "map (\&block)"
58       "grep (\&block)"
59           Note that, in both the above, $_ is in scope within the code block,
60           as well as being passed as $_[0]. As per CORE::map and CORE::grep,
61           $_ is an alias to the list value, so can be used to modify the
62           list, viz:
63
64               use Moose::Autobox;
65
66               my $foo = [1, 2, 3];
67               $foo->map( sub {$_++} );
68               print $foo->dump;
69
70           yields
71
72              $VAR1 = [
73                        2,
74                        3,
75                        4
76                      ];
77
78       "reverse"
79       "sort (?\&block)"
80
81   Junctions
82       "all"
83       "any"
84       "none"
85       "one"
86       "meta"
87       "print"
88       "say"
89

SUPPORT

91       Bugs may be submitted through the RT bug tracker
92       <https://rt.cpan.org/Public/Dist/Display.html?Name=Moose-Autobox> (or
93       bug-Moose-Autobox@rt.cpan.org <mailto:bug-Moose-Autobox@rt.cpan.org>).
94
95       There is also a mailing list available for users of this distribution,
96       at <http://lists.perl.org/list/moose.html>.
97
98       There is also an irc channel available for users of this distribution,
99       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
100

AUTHOR

102       Stevan Little <stevan.little@iinteractive.com>
103
105       This software is copyright (c) 2006 by Infinity Interactive, Inc.
106
107       This is free software; you can redistribute it and/or modify it under
108       the same terms as the Perl 5 programming language system itself.
109
110
111
112perl v5.30.0                      2019-07-26          Moose::Autobox::Array(3)
Impressum