Directo...eue::Set(3)

πŸ“¦
version 2.2 Β· 3 versions
, in epel 9

πŸ‘‘ Directory::Queue::Set(3)

okay so bestie, this is a page from the User Contributed Perl Documentation section of the manual (yeah, the fancy (3) means it's a library/module thing, iykyk), and it's genuinely iconic. stay with me πŸ’…


✨ NAME ✨

Directory::Queue::Set β€” an object oriented interface to a set of Directory::Queue objects πŸŽ€

like, it's a set. of queues. the math girlies could never.


πŸ¦‹ SYNOPSIS πŸ¦‹

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();
}

fr fr that's the whole vibe β€” you build a little squad of queues, then you walk through them like one single queue. no cap. πŸ”₯


🌸 DESCRIPTION 🌸

This module lets you put a bunch of different queues into one set and browse them as if they were one queue. the elements from all the queues get merged together and sorted independently from the queue they belong to β€” so the set doesn't care which queue an element came from, it just serves them up in order. main character energy only. πŸ‘‘

It works with both Directory::Queue::Normal and Directory::Queue::Simple queues. and yes, bestie, you can even mix queues of different types in the same set. we love a diverse friend group 🌈


πŸ’– METHODS πŸ’–

The following methods are available:

🌟 new([DIRQ...])

returns a brand new Directory::Queue::Set object containing the queue objects you pass in β€” it's a class method, so you call it on the class itself, not on an instance. slay. ✨

🌟 add([DIRQ...])

adds the given queue objects to the queue set. heads up: it resets the iterator, so if you were mid-walk, you're starting over, sorry babe 😭

🌟 remove([DIRQ...])

removes the given queue objects from the queue set. also resets the iterator β€” same deal, iterator goes bye-bye πŸ™ˆ

🌟 first()

returns the first (queue, element) couple in the queue set, and resets the iterator. if the queue is empty it returns an empty list. it's giving "new beginning" πŸ¦‹

🌟 next()

returns the next (queue, element) couple in the queue set. if there's no next element, you get an empty list β€” that's your signal to stop looping, bestie πŸ’€

🌟 count()

returns the total number of elements in all the queues of the set. she counted every single one, and she's proud 🫢


πŸ” SEE ALSO πŸ”

  • Directory::Queue β€” the parent vibe, go look at it πŸ‘€

πŸ’œ AUTHOR πŸ’œ

Lionel Cons <http://cern.ch/lionel.cons>

Copyright (C) CERN 2010-2022


okay that's a wrap, bestie πŸŽ€ this little beauty came to you courtesy of perl v5.32.1 and was dated 2022-07-20 β€” go forth and merge those queues, you've got this πŸ’…βœ¨

πŸ“¦ where this page comes from