WWW::Mechanize::Plugin::Sleepy - A WWW::Mechanize plugin to provide the behaviour of WWW::Mechanize::Sleepy while using WWW::Mechanize::Pluggable
version 0.003
Set all Mechanize objects to sleep for 5 seconds between requests:
use WWW::Mechanize::Pluggable Sleepy => [ sleep => 5 ];
or, set single Mechanize instance to sleep for 5 seconds between requests:
use WWW::Mechanize::Pluggable; my $mech = WWW::Mechanize::Pluggable->new( sleep => 5 );
To change sleep time:
$mech->sleep(2); # now sleep for 2 seconds per request
To sleep for a random number of seconds, specify the range as a string in the following format:
'i1..i2' # e.g. will sleep between 5 and 10 seconds, inclusive $mech->sleep('5..10');
This module makes it easy to slow down WWW::Mechanize when using WWW::Mechanize::Pluggable, in the manner of WWW::Mechanize::Sleepy.
The code merely adds hooks containing a sleep() before several WWW::Mechanize methods, but is possibly preferable to scattering sleep()s throughout code in order to slow down tests, for example.
sleep()
$mech->sleep(1); $mech->sleep('5..10'); my $sleep = $mech->sleep;
Get/set sleep time
Code and tests based on WWW::Mechanize::Sleepy
WWW::Mechanize::Sleepy
WWW::Mechanize::Pluggable
Please report any bugs or feature requests through the issue tracker at https://github.com/mjemmeson/www-mechanize-plugin-sleepy/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/mjemmeson/www-mechanize-plugin-sleepy
git clone git://github.com/mjemmeson/www-mechanize-plugin-sleepy.git
Michael Jemmeson <michael.jemmeson@cpan.org>
This software is copyright (c) 2012 by Foxtons Ltd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WWW::Mechanize::Plugin::Sleepy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Mechanize::Plugin::Sleepy
CPAN shell
perl -MCPAN -e shell install WWW::Mechanize::Plugin::Sleepy
For more information on module installation, please visit the detailed CPAN module installation guide.