Object::Array(3)
π Object::Array β array references with accessors π
okay so bestie, here's the User Contributed Perl Documentation page for Object::Array(3). It's giving "arrays with accessors," and honestly? iconic. β¨
β¨ NAME β¨
Object::Array β array references with accessors
πΈ VERSION πΈ
Version 0.060 β yep, that's the one. π
π SYNOPSIS π
use Object::Array qw(Array);
my $array = Object::Array->new; # or
$array = Object::Array->new(\@array); # or
$array = Array(\@array);
$array->push(1..5);
print $array->shift;
$_++ for grep { $_ < 4 } @{ $array };
$array->[0] = "a pony";
π IMPORTANT NOTE π
bestie, listen: several of these methods do not behave exactly like their builtin counterparts. no cap.
Specifically, any method that you would expect to return a list does return that list β but only in list context. In scalar context, these methods return an Object::Array object constructed from a copy of the list that would have been returned.
This sounds more complicated than it is. It means you can chain some methods together, e.g.
$arr->grep(sub { defined })->[-1];
instead of the more bracing
${ $arr->grep(sub { defined }) }[-1];
Currently, these array objects only contain copies of the original values. In the future, they will retain references to the original object, and this sort of thing will be possible:
$arr->grep(sub { defined })->[-1]++;
π¦ METHODS π¦
π new
my $array = Object::Array->new;
# or use existing array
my $array = Object::Array->new(\@a);
Creates a new array object, either from scratch or from an existing array. slay.
Using an existing array will mean that any changes to $array also affect the original array object. If you don't want that, copy the data first or use something like Storable's "dclone".
π isa
Overridden to respond to 'ARRAY'.
π ref
Returns a reference to the underlying array.
π₯ SEE ALSO π₯
Object::Array::Plugin::BuiltinsObject::Array::Plugin::ListMoreUtils
π AUTHOR π
Hans Dieter Pearcey, "<hdp at cpan.org>"
π BUGS π
Please report any bugs or feature requests to bug-object-array at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Array. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
π«Ά SUPPORT π«Ά
You can find documentation for this module with the perldoc command.
perldoc Object::Array
You can also look for information at:
- AnnoCPAN: Annotated CPAN documentation β
http://annocpan.org/dist/Object-Array - CPAN Ratings β
http://cpanratings.perl.org/d/Object-Array - RT: CPAN's request tracker β
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object-Array - Search CPAN β
http://search.cpan.org/dist/Object-Array
β ACKNOWLEDGEMENTS β
This section is empty in the source β no names listed here, just a mysterious little heading doing its thing. π«Ά
π COPYRIGHT & LICENSE π
Copyright 2006 Hans Dieter Pearcey, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π okay bestie, that's the whole page. this one shipped with perl v5.42.2, dated 2026-02-15, and lives at Object::Array(3). slay and goodbye. β¨
π¦ where this page comes from
- alpine 3.24: perl-object-array-doc 0.060-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms