The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

EO::Array - array type collection

SYNOPSIS

  use EO::Array;

  $array = EO::Array->new();
  $array->object_at_index( 0, 'bar' );

  my $thing = $array->object_at_index( 0 );
  $thing->delete( 0 );

  $array->push('value');
  my $value = $array->shift( $array->unshift( $array->pop() ) );

  my $count = $array->count;

DESCRIPTION

EO::Array is an OO wrapper around Perl's array type.

INHERITANCE

EO::Array inherits from EO::Collection.

CONSTRUCTOR

EO::Array provides the following constructors beyond those that the parent class provides:

new_with_array( ARRAYREF )

Prepares a EO::Array object that has all the elements contained in ARRAYREF.

METHODS

object_at_index( KEY [, VALUE] )

Gets and sets key value pairs. KEY should always be an integer. If provided VALUE will be placed in the EO::Array object at the index KEY.

delete( KEY )

Deletes a key/value pair, indexed by key, from the EO::Array object.

count

Returns an integer representing the number of key/value pairs in the EO::Array object.

iterator

Returns a Perl array.

pop

Removes an item from the end of the EO::Array and returns it

push( LIST )

Adds items on to the end of the EO::Array object

shift

Removes an item from the beginning of the EO::Array

unshift( LIST )

Adds items on to the beginning of the EO::Array object

splice( [OFFSET [, LENGTH [, LIST]]] )

Splice an array (see perldoc -f splice for more information).

SEE ALSO

EO::Collection, EO::Hash

AUTHOR

James A. Duncan <jduncan@fotango.com>

COPYRIGHT

Copyright 2003 Fotango Ltd. All Rights Reserved.

This module is released under the same terms as Perl itself.