SQL::Engine::Collection - Generic Object Container
Generic Object Container
use SQL::Engine::Collection; my $collection = SQL::Engine::Collection->new; # $collection->count; # 0
This package provides a generic container for working with sets of objects.
This package uses type constraints from:
Types::Standard
This package has the following attributes:
items(ArrayRef[Object])
This attribute is read-only, accepts (ArrayRef[Object]) values, and is optional.
(ArrayRef[Object])
This package implements the following methods:
clear() : Bool
The clear method clears the collection and returns an empty list.
# given: synopsis $collection->clear;
count() : Int
The count method counts and returns the number of items in the collection.
# given: synopsis $collection->count;
each(CodeRef $value) : ArrayRef[Any]
The each method iterates through the collection executing the callback for each item and returns the set of results.
# given: synopsis $collection->each(sub { my ($item) = shift; $item });
first() : Maybe[Object]
The first method returns the first item in the collection.
# given: synopsis $collection->first;
last() : Maybe[Object]
The last method returns the last item in the collection.
# given: synopsis $collection->last;
list() : ArrayRef
The list method returns the collection as a list of items.
# given: synopsis $collection->list;
pop() : Maybe[Object]
The pop method removes and returns an item from the tail of the collection.
# given: synopsis $collection->pop;
pull() : Maybe[Object]
The pull method removes and returns an item from the head of the collection.
# given: synopsis $collection->pull;
push(Object @values) : Int
The push method inserts an item onto the tail of the collection and returns the count.
# given: synopsis $collection->push(bless {});
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install SQL::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::Engine
CPAN shell
perl -MCPAN -e shell install SQL::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.