NAME
Dezi::Bot::Queue - web crawler queue
SYNOPSIS
use Dezi::Bot::Queue;
my $queue = Dezi::Bot::Queue->new(
type => 'DBI',
dsn => "DBI:mysql:database=$database;host=$hostname;port=$port",
username => 'myuser',
password => 'mysecret',
);
my $uri = 'http://dezi.org/bot.html';
$queue->put($uri);
$queue->size(); # returns number of items in queue
$queue->peek; # returns $uri (next value for get())
$queue->get; # returns $uri and removes it from queue
DESCRIPTION
The Dezi::Bot::Queue module adheres to the API of SWISH::Prog::Queue while optimized for persistent storage.
METHODS
new( config )
Returns a new Dezi::Bot::Queue object. config should be a series of key/value pairs (a hash). Supported config params are:
- type
-
The backend storage type. Defaults to 'DBI' (see Dezi::Bot::Queue::DBI).
- dsn
-
If type is
DBI
then the dsn value will be passed directly to the DBI->connect() method. - username
-
If type is
DBI
then the username value will be passed directly to the DBI->connect() method. - password
-
If type is
DBI
then the password value will be passed directly to the DBI->connect() method. - table_name
-
If type is
DBI
then the table_name value will be used to insert rows. Defaults todezi_queue
. - quote
-
If type is
DBI
then the quote value will be used to quote column names on insert. Defaults tofalse
. - quote_char
-
If type is
DBI
then the quote_char value will be used when quote is true. Defaults to backtick.
init_store
All subclasses must implement this abstract method. Called internally in new().
name
Get/set the name of the queue.
put( item )
Add item to the queue.
get
Returns the next item.
peek
Returns the next item value, but leaves it on the stack.
size
Returns the number of items currently in the queue.
AUTHOR
Peter Karman, <karman at cpan.org>
BUGS
Please report any bugs or feature requests to bug-dezi-bot at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-Bot. 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 Dezi::Bot
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
Copyright 2013 Peter Karman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.