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

NAME

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

SYNOPOSIS

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

DESCRIPTION

22       This is a role to describe operations on the Array type.
23

METHODS

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

BUGS

88       All complex software has bugs lurking in it, and this module is no
89       exception. If you find a bug please either email me, or add the bug to
90       cpan-RT.
91

AUTHOR

93       Stevan Little <stevan@iinteractive.com>
94
96       Copyright 2006-2008 by Infinity Interactive, Inc.
97
98       <http://www.iinteractive.com>
99
100       This library is free software; you can redistribute it and/or modify it
101       under the same terms as Perl itself.
102
103
104
105perl v5.12.2                      2010-04-23          Moose::Autobox::Array(3)
Impressum