NAME

XML::Pastor::Stack - A Stack!

WARNING

This module is used internally by XML::Pastor. You do not normally know much about this module to actually use XML::Pastor. It is documented here for completeness and for XML::Pastor developers. Do not count on the interface of this module. It may change in any of the subsequent releases. You have been warned.

SYNOPSIS

use XML::Pastor::Stack;
my $stack = new XML::Pastor::Stack();

DESCRIPTION

Quite simple, really. Just a stack implemented via an array.

This module is a blunt copy of the Data::Stack module. I had originally intended to use that module but it turns out that it -superflously- requires perl 5.8.6 to build and I only had perl 5.8.4 on my system with no means to upgrade. So that's why I had to copy all the code in Data::Stack into this otherwise needless module.

METHODS

new( [ @ITEMS ] )

Creates a new XML::Pastor::Stack. If passed an array, those items are added to the stack.

peek()

Returns the item at the top of the stack but does not remove it.

get($INDEX)

Returns the item at position $INDEX in the stack but does not remove it. 0 based.

count()

Returns the number of items in the stack.

empty()

Returns a true value if the stack is empty. Returns a false value if not.

clear()

Completely clear the stack.

pop()

Removes the item at the top of the stack and returns it.

push($item)

Adds the item to the top of the stack.

EXPORT

None by default.

SEE ALSO

There are various Stack packages out there but none of them seemed simple enough. Here we are!

AUTHOR

Ayhan Ulusoy <dev(at)ulusoy(dot)name>

The author of the original module Data::Stack is: Cory Watson, <cpan@onemogin.com>

COPYRIGHT AND LICENSE

Copyright (C) 2006-2007 by Ayhan Ulusoy. (A shame, as the code is copied from Data::Stack by Cory Watson)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.