Moose:...::Array(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Moose::Autobox::Array β€” the Array role πŸ’–

okay bestie, welcome to the Moose::Autobox::Array page, straight out of the User Contributed Perl Documentation section of your friendly neighbourhood man pages. It's the manual for Moose:...::Array(3pm), and yes we're doing this together, hand in hand, no cap. 🫢


✨ NAME ✨

Moose::Autobox::Array β€” the Array role. That's it, that's the name, she's iconic. πŸ‘‘


🌸 VERSION 🌸

version 0.16 β€” this is the version we're talking about, don't come for her, she's doing her best. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the vibe, copy-paste ready, character for character:

use Moose::Autobox;

[ 1..5 ]->isa('ARRAY'); # true
[ a..z ]->does('Moose::Autobox::Array'); # true
[ 0..2 ]->does('Moose::Autobox::List'); # true

print "Squares: " . [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');

print [ 1, 'number' ]->sprintf('%d is the loneliest %s');

print ([ 1 .. 5 ]->any == 3) ? 'true' : 'false'; # prints 'true'

like look at her. array literals just doing methods. that's the whole flex. πŸ”₯


πŸ’œ DESCRIPTION πŸ’œ

This is a role to describe operations on the Array type. periodt. πŸ’–


πŸŽ€ METHODS πŸŽ€

the whole roster, no one left out, everyone eats:

  • "pop"
  • "push ($value)"
  • "shift"
  • "unshift ($value)"
  • "delete ($index)"
  • "sprintf ($format_string)"
  • "slice (@indices)"
  • "flatten"
  • "flatten_deep ($depth)"
  • "first"
  • "last"

🌈 Indexed implementation 🌈

the index-girlies, living their numbered truth:

  • "at ($index)"
  • "put ($index, $value)"
  • "exists ($index)"
  • "keys"
  • "values"
  • "kv"
  • "each"
  • "each_key"
  • "each_value"
  • "each_n_values ($n, $callback)"

🧚 List implementation 🧚

and the list-besties, no indices required:

  • "head"
  • "tail"
  • "join (?$seperator)"
  • "length"
  • "map (\&block)"
  • "grep (\&block)"
⚠️ note, bestie, and this part is IMPORTANT: in both the above, $_ is in scope within the code block, as well as being passed as $_[0]. As per CORE::map and CORE::grep, $_ is an alias to the list value, so can be used to modify the list, viz:
use Moose::Autobox;

my $foo = [1, 2, 3];
$foo->map( sub {$_++} );
print $foo->dump;

yields

$VAR1 = [
          2,
          3,
          4
        ];
  • "reverse"
  • "sort (?\&block)"

⭐ Junctions ⭐

the choose-your-own-adventure section:

  • "all"
  • "any"
  • "none"
  • "one"
  • "meta"
  • "print"
  • "say"

🫢 SUPPORT 🫢

found a bug? she's not perfect, she's just a girl. Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Moose-Autobox> (or bug-Moose-Autobox@rt.cpan.org <mailto:bug-Moose-Autobox@rt.cpan.org>).

There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/moose.html>. πŸ“

There is also an irc channel available for users of this distribution, at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>. come say hi, we don't bite, we just compile. πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

Stevan Little <stevan.little@iinteractive.com> β€” the main character who wrote this. respect. ✨


This software is copyright (c) 2006 by Infinity Interactive, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πŸŽ€


and that's the page bestie, we did it, ate and left no crumbs πŸ’…βœ¨. quick sign-off for the record: this whole thing comes to you from perl v5.34.0, dated 2022-06-15, filed under Moose:...::Array(3pm) in the User Contributed Perl Documentation. byeee, go write some arrays that know their own methods πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from