
GX::Callback::Queue - Callback queue class

# Load the class
use GX::Callback::Queue;
# Create a new callback queue
$queue = GX::Callback::Queue->new;
# Add a callback
$queue->add( GX::Callback->new( sub { say "Hello!" } ) );
# Process
while ( my $callback = $queue->next ) {
$callback->call;
}

This module provides the GX::Callback::Queue class.

newReturns a new GX::Callback::Queue object.
$queue = GX::Callback::Queue->new;
$queue ( GX::Callback::Queue object )addAdds the given callback objects to the end of the queue.
$queue->add( @callbacks );
@callbacks ( GX::Callback objects )allReturns all queued callback objects.
@callbacks = $queue->all;
@callbacks ( GX::Callback objects )Calling this method does not modify the queue.
clearClears the queue.
$queue->clear;
cloneClones the queue.
$cloned_queue = $queue->clone;
$cloned_queue ( GX::Callback::Queue object )currentReturns the current callback object (i.e. the one returned by the last next() call).
$callback = $queue->current;
$callback ( GX::Callback object | undef )nextRemoves the next callback object from the queue and returns it.
$callback = $queue->next;
$callback ( GX::Callback object | undef )removeRemoves the given callback objects from the queue.
$result = $queue->remove( @callbacks );
@callbacks ( GX::Callback objects )$result ( integer )remove_allRemoves all remaining callback objects from the queue.
$queue->remove_all;
replace_allReplaces the remaining callback objects with the given ones.
$queue->replace_all( @callbacks );
@callbacks ( GX::Callback objects )

Jörg A. Uzarek <uzarek@runlevelnull.de>

Copyright (c) 2009-2011 Jörg A. Uzarek.
This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.