NAME

POE::Component::MessageQueue::Storage::Structure::DLList - A simple doubly-linked list for wheel-reinventing goodness.

SYNOPSIS

use POE::Component::MessageQueue::Storage::Structure::DLList;

my $list = POE::Component::MessageQueue::Storage::Structure::DLList->new();
$list->push(1);
$list->push(2);
$list->pop(); # --> 2;

$list->unshift($_) for (1..20);

# List cells know how to delete themselves
$list->next()->next()->delete();

DESCRIPTION

Just a doubly linked list with the common list methods (push, pop, etc.). The main point of using this module instead of standard perl arrays is that cells know how to delete themselves from the list. Thich lets us do some tricky things like having a hash that points to queue cells and doing deletion from lists by some arbitrary hash index in O(1).

Individual cells in the list are instances of POE::Component::MessageQueue::Storage::Structure::DLList::Cell

METHODS

These are intended to be called on the return value of new(), and deal with operations on the whole list (rather than individual cells in it).

new

Returns a DLList with nothing in it. This is what you call list methods on.

shift
unshift
push
pop

These work just like the builtins. Pop and shift return you the data that was in the (now useless) list cell. Push and unshift return you the list cell.

queue
dequeue

These work just like push/shift. In fact, they probably are push/shift.

first
last

The first and last cells in the list, respectively.

BUGS AND LIMITATIONS

This is fairly slow for most things you'd use a list for - much slower than vanilla perl arrays. Only use this if you know what you're doing and need the advantages it offers!

SEE ALSO

POE::Component::MessageQueue::Storage::Structure::DLList::Cell

AUTHOR

Paul Driver <frodwith@gmail.com>