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 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;
@items to the queue.
Returns the number of elements in the queue.
@items to the top of the queue in an order such that
dequeue(1) would subsequently return
$items and so forth.
Mary Ehlers <email@example.com>
This software is Copyright (c) 2017 by Mary Ehlers.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004