GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Object::Array(3) User Contributed Perl Documentation Object::Array(3)

Object::Array - array references with accessors

Version 0.060

  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";

Several of these methods do not behave exactly like their builtin counterparts.

Specifically, any method that you would expect to return a list does so, but only in list context. In scalar context, these methods will 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 that 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]++;

  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.

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".

Overridden to respond to 'ARRAY'.

Returns a reference to the underlying array.

Object::Array::Plugin::Builtins

Object::Array::Plugin::ListMoreUtils

Hans Dieter Pearcey, "<hdp at cpan.org>"

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.

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>

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.

2006-08-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.