NAME
WWW::Agent::Zombie - Walking through websites like a zombie
SYNOPSIS
use WWW::Agent::Zombie;
my $z = new WWW::Agent::Zombie ();
$z->run (q{...
# some WeeZL here
});
DESCRIPTION
This package provides a way to let zombies stalk the earth. Seriously, a plan (written in WeeZL, a simple text language, see WWW::Agent::Plugins::Director) controls a WWW::Agent object.
INTERFACE
Constructor
The constructor expects a hash with the following key/value pairs:
functions
(hash reference, optional):-
In a WeeZL script you can refer to functions which you can provide here. The keys are the names of the functions as the can appear in the WeeZL script, as values you have to pass in subroutine references.
When such a subroutine is invoked, it will get the current context as parameter. See WWW::Agent::Plugins::Director for details.
Example:
my $zombie = new WWW::Agent::Zombie (functions => { 'test' => sub { warn "here I am"; } 'test2' => sub { warn "and again"; }, });
time_dither
(string, percentation number, optional)-
In WeeZL scripts you can ask the agent to pause for a time interval. If you specify there
~ 4 secs
(wait for approximately 5 seconds), then the time dither factor controls, what approximately means.In case of
20%
, the actual waiting time will randomly range from 4 to 6 seconds.The default is
10%
.
Methods
run
-
This method expects a string with a script written in WeeZL. If that is missing, the default
die "no plan to run"
will be used. Once this executes, obviously we return with an exception.
The method will not return until the WeeZL script has terminated. Any infinite loop there will be exactly that. If the WeeZL script contains execptions, these will be caught and re-raised into your application.
Example:
$zombie->run (q{ goto http://www.example.org/ wait ~ 15 secs goto http://www.example.org/login.php });
AUTHOR
Robert Barta, <rho@bigpond.net.au>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Robert Barta
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.