NAME
EntityModel::Array - wrapper object for dealing with arrayrefs
VERSION
Version 0.016
DESCRIPTION
Primarily intended as an abstract interface for use with EntityModel backend storage.
METHODS
new
Instantiates with the given arrayref
count
Returns the number of items in the arrayref if called without parameters. This is the recommended usage.
If passed a coderef, will call that coderef with the count, and return $self instead.
list
Returns all items from the arrayref.
push
Push the requested value onto the end of the arrayref.
splice
Support for the "splice" in perlfunc operation.
Takes an offset, length and zero or more items, splices those into the array, invokes the splice
event, then returns $self.
add_watch
Add a coderef to be called when the array changes.
remove_watch : method
Removes a watch from this array.
Returns $self.
shift
Shift the first value out of the arrayref.
pop
Pops the last value from the arrayref.
unshift
Unshifts a value onto the start of the arrayref.
join
Joins the entries in the arrayref using the given value and returns as a scalar.
each
Perform coderef on each entry in the arrayref.
first
Returns the first entry in the arrayref.
last
Returns the last entry in the arrayref.
grep
Calls the coderef on each entry in the arrayref and returns the entries for which it returns true.
remove
Remove entries from the array.
Avoid rebuilding the array in case we have weak refs, just splice out the values indicated.
clear
Empty the arrayref.
arrayref
Returns the arrayref directly.
is_empty
Returns true if there's nothing in the arrayref.
SEE ALSO
Use autobox instead.
INHERITED METHODS
- Mixin::Event::Dispatch
-
add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event
AUTHOR
Tom Molesworth <cpan@entitymodel.com>
LICENSE
Copyright Tom Molesworth 2008-2014. Licensed under the same terms as Perl itself.