Where do you test for the UNDEF that ->dequeue_nb returns when it hits the end of the queue?
"dequeue_nb
The dequeue_nb method, like the dequeue method, removes a scalar from the head of the queue and returns it. Unlike dequeue, though, dequeue_nb won't block if the queue is empty, instead returning undef.
"