NAME

List::Priority - Perl extension for a list that manipulates objects by their priority

SYNOPSIS

use List::Priority;

# Create an instance
$list = List::Priority->new();

# Insert some elements, each woth a unique priority
$list->insert(2,'World!');
$list->insert(5,'Hello');
$list->insert(3,' ');

# Print
while ($list->pop()) {
	  print $_;
}

DESCRIPTION

If you want to handle multiple data bits by their order of importance - This one's for you.

Logic: Precedence to highest priority object. If more than one object hold the highest priority - FIFO is king.

Duplicate objects are currently not allowed.

I'd like to thank Joseph N. Hall and Randal L. Schwartz for their excellent book "Effective Perl Programming" for one of the code hacks...

Methods

      $p_list = List::Priority->new();
    	  

    new is the constructor for List::Priority objects

    insert - List insertion

      $result = $p_list->insert($priority, $scalar);
    	  

    Inserts the scalar to the list

    Arguments: - Priority must be numeric. - Scalar can be any scalar, including references (objects)

    Return value: 1 on success, a string describing the error upon failure

    pop - List extraction

      $object = $p_list->pop();
    	  

    Extracts the scalar from the list according to the specified logic.

    Arguments: - None.

    Return value: The object on success, undef upon failure

EXPORT

None. All interfaces are OO.

AUTHOR

Eyal Udassin, <eyaludassin@hotmail.com>

SEE ALSO

Set::Scalar.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 106:

=over should be: '=over' or '=over positive_number'

You can't have =items (as at line 113) unless the first thing after the =over is an =item

Around line 139:

You forgot a '=back' before '=head2'