Queue::DBI::Element - An object representing an element pulled from the queue.
Version 2.5.0
Please refer to the documentation for Queue::DBI.
Create a new Queue::DBI::Element object.
my $element = Queue::DBI::Element->new( 'queue' => $queue, 'data' => $data, 'id' => $id, 'requeue_count' => $requeue_count, 'created' => $created, );
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();
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"; }
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"; }
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"; }
Returns the data initially queued.
my $data = $element->data();
Returns the number of times that the current element has been requeued.
my $requeue_count = $element->requeue_count();
Returns the ID of the current element
my $id = $element->id();
Returns the unixtime at which the element was originally created.
my $created = $element->get_created_time();
Returns a boolean indicating whether the current element is over the lifetime specified when instanciating the queue. This is especially helpful if you retrieve a large batch of elements and do long processing operations on each of them.
my $is_over_lifetime = $element->is_over_lifetime();
Returns the Queue::DBI object used to pull the current element.
my $queue = $element->get_queue();
Guillaume Aubert, <aubertg at cpan.org>.
<aubertg at cpan.org>
Please report any bugs or feature requests to bug-queue-dbi 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.
bug-queue-dbi at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Queue::DBI::Element
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Queue-DBI
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Queue-DBI
CPAN Ratings
http://cpanratings.perl.org/d/Queue-DBI
Search CPAN
http://search.cpan.org/dist/Queue-DBI/
Thanks to ThinkGeek (http://www.thinkgeek.com/) and its corporate overlords at Geeknet (http://www.geek.net/), for footing the bill while I write code for them!
Thanks to Jacob Rose <jacob at thinkgeek.com>, who wrote the first queueing module at ThinkGeek http://www.thinkgeek.com and whose work provided the inspiration to write this full-fledged queueing system.
<jacob at thinkgeek.com>
Thanks to Jamie McCarthy for the locking mechanism improvements in version 1.1.0.
Thanks to Sergey Bond for suggesting many features added in version 1.8.x (lifetime constraint, purge() function, get/set functions cleanup).
Copyright 2009-2012 Guillaume Aubert.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
To install Queue::DBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Queue::DBI
CPAN shell
perl -MCPAN -e shell install Queue::DBI
For more information on module installation, please visit the detailed CPAN module installation guide.