Directory::Queue::Set - object oriented interface to a set of Directory::Queue objects
use Directory::Queue; use Directory::Queue::Set; $dq1 = Directory::Queue->new(path => "/tmp/q1"); $dq2 = Directory::Queue->new(path => "/tmp/q2"); $dqset = Directory::Queue::Set->new($dq1, $dq2); ($dq, $elt) = $dqset->first(); while ($dq) { # you can now process the element $elt of queue $dq... ($dq, $elt) = $dqset->next(); }
This module can be used to put different queues into a set and browse them as one queue. The elements from all queues are merged together and sorted independently from the queue they belong to.
This works both with Directory::Queue::Normal and Directory::Queue::Simple queues. Queues of different types can even be mixed.
The following methods are available:
return a new Directory::Queue::Set object containing the given queue objects (class method)
add the given queue objects to the queue set; resetting the iterator
remove the given queue objects from the queue set; resetting the iterator
return the first (queue, element) couple in the queue set, resetting the iterator; return an empty list if the queue is empty
return the next (queue, element) couple in the queue set; return an empty list if there is no next element
return the total number of elements in all the queues of the set
Directory::Queue.
Lionel Cons http://cern.ch/lionel.cons
Copyright (C) CERN 2010-2022
To install Directory::Queue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Directory::Queue
CPAN shell
perl -MCPAN -e shell install Directory::Queue
For more information on module installation, please visit the detailed CPAN module installation guide.