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.
new
Returns a new GX::Callback::Queue object.
$queue = GX::Callback::Queue->new;
$queue ( GX::Callback::Queue object )
$queue
add
Adds the given callback objects to the end of the queue.
$queue->add( @callbacks );
@callbacks ( GX::Callback objects )
@callbacks
GX::Exception
all
Returns all queued callback objects.
@callbacks = $queue->all;
Calling this method does not modify the queue.
clear
Clears the queue.
$queue->clear;
clone
Clones the queue.
$cloned_queue = $queue->clone;
$cloned_queue ( GX::Callback::Queue object )
$cloned_queue
current
Returns the current callback object (i.e. the one returned by the last next() call).
next()
$callback = $queue->current;
$callback ( GX::Callback object | undef )
$callback
undef
next
Removes the next callback object from the queue and returns it.
$callback = $queue->next;
remove
Removes the given callback objects from the queue.
$result = $queue->remove( @callbacks );
$result ( integer )
$result
remove_all
Removes all remaining callback objects from the queue.
$queue->remove_all;
replace_all
Replaces the remaining callback objects with the given ones.
$queue->replace_all( @callbacks );
GX::Callback
GX::Callback::Hook::Queue
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.
To install GX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GX
CPAN shell
perl -MCPAN -e shell install GX
For more information on module installation, please visit the detailed CPAN module installation guide.