WWW::Crawler::Mojo::Queue - Crawler queue base class
my $queue = WWW::Crawler::Mojo::Queue::Memory->new; $queue->enqueue($job1); $queue->enqueue($job2); say $queue->length # 2 $job3 = $queue->next(); # $job3 = $job1 $job4 = $queue->dequeue(); # $job4 = $job1 say $queue->length # 1
This class represents a FIFO queue.
Shifts the oldest job and returns it.
my $job = $queue->deuque;
$queue->enqueue($job);
Pushes a job unless the job has been already pushed before.
Returns the job which will be dequeued next. It also accept an offset to get any future job.
$queue->next; # meaning $queue->next(0) $queue->next(1); $queue->next(2);
Returns queue length
say $queue->length
Pushes a job regardless of the job has been enqueued before or not.
$queue->requeue($job);
Shuffles the queue array.
$queue->shuffle;
Keita Sugama, <sugama@jamadam.com>
Copyright (C) Keita Sugama.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Crawler::Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Crawler::Mojo
CPAN shell
perl -MCPAN -e shell install WWW::Crawler::Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.