The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Queue::DBI::Element - An object representing an element pulled from the queue

VERSION

Version 1.6

SYNOPSIS

Please refer to the documentation for Queue::DBI.

METHODS

new()

Create a new Queue::DBI::Element object.

        my $element = Queue::DBI::Element->new(
                'queue'         => $queue,
                'data'          => $data,
                'id'            => $id,
                'requeue_count' => $requeue_count,
        );

All parameters are mandatory and correspond respectively to the Queue::DBI object used to pull the element's data, the data, the ID of the element in the database and the number of times the element has been requeued before.

It is not recommended for direct use. You should be using the following to get Queue::DBI::Element objects:

        my $queue = $queue->next();

lock()

Locks the element so that another process acting on the queue cannot get a hold of it

        if ( $element->lock() )
        {
                print "Element successfully locked.\n";
        }
        else
        {
                print "The element has already been removed or locked.\n";
        }

requeue()

In case the processing of an element has failed

        if ( $element->requeue() )
        {
                print "Element successfully requeued.\n";
        }
        else
        {
                print "The element has already been removed or been requeued.\n";
        }

success()

Removes the element from the queue after its processing has successfully been completed.

        if ( $element->success() )
        {
                print "Element successfully removed from queue.\n";
        }
        else
        {
                print "The element has already been removed.\n";
        }

data()

Returns the data initially queued.

        my $data = $element->data();

requeue_count()

Returns the number of times that the current element has been requeued.

id()

Returns the ID of the current element

        my $id = $element->id();

INTERNAL METHODS

queue()

Returns the Queue::DBI object used to pull the current element.

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

BUGS

Please report any bugs or feature requests to bug-queue-safe at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Queue-DBI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc Queue::DBI

You can also look for information at:

ACKNOWLEDGEMENTS

Thanks to Geeknet, Inc. http://www.geek.net for funding the initial development of this code!

COPYRIGHT & LICENSE

Copyright 2009 Guillaume Aubert.

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License.

See http://dev.perl.org/licenses/ for more information.