Piper::Queue - Simple FIFO queue used by Piper
use Piper::Queue; my $queue = Piper::Queue->new(); $queue->enqueue(qw(x y)); $queue->ready; # 2 $queue->dequeue; # 'x' $queue->requeue('x'); $queue->dequeue; # 'x'
Remove and return at most $num items from the queue. The default $num is 1.
$num
If $num is greater than the number of items remaining in the queue, only the number remaining will be dequeued.
Returns an array of items if wantarray, otherwise returns the last of the dequeued items, which allows singleton dequeues:
my @results = $queue->dequeue($num); my $single = $queue->dequeue;
Add @items to the queue.
@items
Returns the number of elements in the queue.
Inserts @items to the top of the queue in an order such that dequeue(1) would subsequently return $items[0] and so forth.
dequeue(1)
$items[0]
version 0.05
Mary Ehlers <ehlers@cpan.org>
This software is Copyright (c) 2017 by Mary Ehlers.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Piper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Piper
CPAN shell
perl -MCPAN -e shell install Piper
For more information on module installation, please visit the detailed CPAN module installation guide.