Array-Queue
view release on metacpan or search on metacpan
lib/Array/Queue.pm view on Meta::CPAN
package Array::Queue;
$Array::Queue::VERSION = '0.1.2';
use Moose;
use namespace::autoclean;
=head1 NAME
Array::Queue - A simple fifo queue
=head1 VERSION
version 0.1.2
=head1 SYNOPSIS
my $queue = Array::Queue->new;
$ar->add({ id => 20 });
$ar->add({ id => 18 });
$ar->add({ id => 22 });
while ($node = $queue->first) {
# do things with node
$queue->remove;
}
=head1 DESCRIPTION
Array::Queue is a fairly simple First-In / First-Out queue build with Moose.
Any data structure can be added to the queue and retrieved in the order it was
added.
Originally part of Array::Queue::Priority until I decided to break them into two
classes, the one dependant on the other.
=head1 METHODS
=head2 C<add>
$ar->add( 99 );
You can add any type of item to the queue.
=head2 C<remove>
$ar->remove;
Remove the oldest item on the queue.
Returns value removed.
=head2 C<first>
$ar->first;
Returns the first / oldest item in the queue.
Leaves the item in the queue.
=head2 C<queue>
$ar->queue;
( run in 0.958 second using v1.01-cache-2.11-cpan-97f6503c9c8 )