Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

www::mechanize::formfiller::value::random::word(3pm) [debian man page]

WWW::Mechanize::FormFiller::Value::Random::Word(3pm)	User Contributed Perl Documentation   WWW::Mechanize::FormFiller::Value::Random::Word(3pm)

NAME
WWW::Mechanize::FormFiller::Value::Random::Word - Fill a word into an HTML form field SYNOPSIS
use WWW::Mechanize::FormFiller; use WWW::Mechanize::FormFiller::Value::Random::Word; my $f = WWW::Mechanize::FormFiller->new(); # Create a random value for the HTML field "login" my $login = WWW::Mechanize::FormFiller::Value::Random::Word->new( login => size => 1 ); $f->add_value( login => $login ); # Alternatively take the following shorthand, which adds the # field to the list as well : # If there is no password, put a random one out of the list there my $password = $f->add_filler( password => Random::Word => size => 1 ); # Spew some bogus text into the comments field my $comments = $f->add_filler( comments => Random::Word => size => 10 ); DESCRIPTION
This class provides a way to write a randomly chosen value into a HTML field. new NAME, LIST Creates a new value which will correspond to the HTML field "NAME". The "LIST" is the list of arguments passed to Data::Random::rand_words. If the list is empty, "size => 1" is assumed. name [NEWNAME] Gets and sets the name of the HTML field this value corresponds to. value FIELD Returns the value to put into the HTML field. EXPORT None by default. COPYRIGHT AND LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Copyright (C) 2002,2003 Max Maischein AUTHOR
Max Maischein, <corion@cpan.org> Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome ! SEE ALSO
Data::Random, WWW::Mechanize, WWW::Mechanize::Shell, WWW::Mechanize::FormFiller, WWW::Mechanize::FormFiller::Value::Value, WWW::Mechanize::FormFiller::Value::Default, WWW::Mechanize::FormFiller::Value::Fixed, WWW::Mechanize::FormFiller::Value::Interactive perl v5.10.1 2009-04-24 WWW::Mechanize::FormFiller::Value::Random::Word(3pm)

Check Out this Related Man Page

WWW::Mechanize::FormFiller(3pm) 			User Contributed Perl Documentation			   WWW::Mechanize::FormFiller(3pm)

NAME
WWW::Mechanize::FormFiller - framework to automate HTML forms SYNOPSIS
Form fields can be specified by name or by a regular expression. A field specified by name takes precedence over a matching regular expression. You are not limited to fixed form values - callbacks and interactive editing are also already provided : # Create a form filler that asks us for the password # Normally, the HTML would come from a LWP::UserAgent request my $html = "<html><body><form name='f' action='/login.asp'> <input type='text' name='login'> <input type='password' name='password' > <input type='submit' name=Login value='Log in'> <input type='hidden' name='session' value='0xDEADBEEF' /> </form></body></html>"; my $f = WWW::Mechanize::FormFiller->new(); my $form = HTML::Form->parse($html,"http://www.fbi.gov/super/secret/"); $f->add_filler( password => Interactive => []); $f->fill_form($form); my $request = $form->click("Login"); # Now we have a complete HTTP request, which we can hand off to # LWP::UserAgent or (preferrably) WWW::Mechanize print $request->as_string; DESCRIPTION
The module is intended as a simple way to fill out HTML forms from a set of predetermined values. You set up the form filler with value elements, retrieve the HTML form, and let the form filler loose on that form. There are value classes provided for many tasks - fixed values, values to be queried interactively from the user, values taken randomly from a list of values and values specified through a callback to some Perl code. new %ARGS Creates a new instance. The %ARGS hash has two possible keys : "default", whose value should be an array reference consisting of the name of a "WWW::Mechanize::FormFiller::Value" subclass and the optional constructor values. "values" must be an array reference, which contains array and "Files", which takes an array reference to the filenames to watch. Example : add_filler NAME, CLASS, @ARGS Adds a new value to the list of filled fields. "NAME" is the name of the form field, "CLASS" is the name of the class in the "WWW::Mechanize::FormFiller::Value" namespace - it must live below there ! @ARGS is an optional array reference to the parameters that the subclass constructor takes. add_value NAME, VALUE Adds a new WWW::Mechanize::FormFiller::Value subclass to the list of filled fields. "NAME" is the name of the form field, "VALUE" is an object that responds to the interface of "WWW::Mechanize::FormFiller::Value". fill_form FORM Sets the field values in FORM to the values returned by the "WWW::Mechanize::FormFiller::Value" elements. FORM should be of type HTML::Forms or respond to the same interface. fillout @ARGS This is a very dwimmy routine that allows you to intuitively set up values and fill out a form, if needed. It works as both a constructor and a method. The parameters are decoded according to the following examples : $filler = WWW::Mechanize::FormFiller->new(); $filler->fillout( # For the the simple case, assumed 'Fixed' class, name => 'Mark', # With an array reference, create and fill with the right kind of object. widget_id => [ 'Random', (1..5) ], ); $filler = WWW::Mechanize::FormFiller->new(); $filler->fillout( # If the first parameter isa HTML::Form, it is # filled out directly $form, name => 'Mark', motto => [ 'Random::Word', size => 5 ], ); # This works as a direct constructor as well WWW::Mechanize::FormFiller->fillout( $form2, name => 'Mark', motto => [ 'Random::Word', size => 5 ], ); Value subclasses The following WWW::Mechanize::FormFiller::Value subclasses are currently distributed : WWW::Mechanize::FormFiller::Value::Callback WWW::Mechanize::FormFiller::Value::Default WWW::Mechanize::FormFiller::Value::Fixed WWW::Mechanize::FormFiller::Value::Interactive WWW::Mechanize::FormFiller::Value::Keep WWW::Mechanize::FormFiller::Value::Random WWW::Mechanize::FormFiller::Value::Random::Word WWW::Mechanize::FormFiller::Value::Random::Chars WWW::Mechanize::FormFiller::Value::Random::Date EXPORT None by default. COPYRIGHT AND LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Copyright (C) 2002,2003 Max Maischein AUTHOR
Max Maischein, <corion@cpan.org> Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome ! Bug reports are best done via RT at https://rt.cpan.org SEE ALSO
WWW::Mechanize,WWW::Mechanize::Shell,WWW::Mechanize::FormFiller::Value perl v5.10.1 2009-04-24 WWW::Mechanize::FormFiller(3pm)
Man Page