Jason Lavold > File-Queue-1.01a > File::Queue

Download:
File-Queue-1.01a.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.01   Source  

NAME ^

File::Queue - Persistent FIFO queue implemented in pure perl!

SYNOPSIS ^

    use strict; # always!
    use File::Queue;

    my $q = new File::Queue (File => '/var/spool/yourprog/queue');

    $q->enq('some flat text1');
    $q->enq('some flat text2');
    $q->enq('some flat text3');

    # Get up to first 10 elements
    my $contents = $q->peek(10);

    my $elem1 = $q->deq();  
    my $elem2 = $q->deq();  

    # empty the queue
    $q->reset();

DESCRIPTION ^

This module allows for the creation of persistent FIFO queue objects.

File::Queue only handles scalars as queue elements. If you want to work with references, serialize them first!

The module was written with speed in mind, and it is very fast, but it should be used with care. Please refer to the CAVEATS section.

Interface ^

File::Queue implements a OO interface. The object methods and parameters are described below.

Methods

File::Queue supports all of the queue-related functions a developer should expect.

Parameters

There are a number of parameters that can be passed when constructing your File::Queue objects. Parameters are case-insensitive.

CAVEATS ^

This module should never be used in situations where the queue is not expected to become empty.

The '.dat' file is not truncated (emptied) until the queue is empty.

Even the data you've already dequeued remains in the '.dat' file until the queue is empty.

If you keep enqueueing elements and never FULLY dequeue everything, eventually your disk will fill up!

SEE ALSO ^

Tie::File

AUTHOR ^

Jason Lavold <jlavold [ at ] gmail.com>

syntax highlighting: