WWW::M...Filler(3pm)
π WWW::Mechanize::FormFiller π
okay so bestie, welcome to the User Contributed Perl Documentation glow-up of WWW::Mechanize::FormFiller (you'll see it chilling as WWW::M...Filler(3pm) in your pager, no cap) β¨
πΈ NAME πΈ
WWW::Mechanize::FormFiller β the framework that automates HTML forms for you, bestie π
β¨ SYNOPSIS β¨
So here's the tea π: form fields can be specified by name or by a regular expression. And like, a field specified by name takes precedence over a matching regular expression. Periodt. π
Also?? You are not limited to fixed form values β callbacks and interactive editing are also already provided, iykyk:
# 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 π¦
This module is intended as a simple way to fill out HTML forms from a set of predetermined values. The vibe is: you set up the form filler with value elements, retrieve the HTML form, and let the form filler loose on that form. Main character energy tbh. π
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. So many options, we ate π½οΈβ¨
π 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 :
lowkey the original page just says "Example :" and then says nothing, and honestly? we respect the mystery π«Ά
π
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, no exceptions bestie! @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. Slay. β¨
π 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 β collect them all, bestie π:
WWW::Mechanize::FormFiller::Value::CallbackWWW::Mechanize::FormFiller::Value::DefaultWWW::Mechanize::FormFiller::Value::FixedWWW::Mechanize::FormFiller::Value::InteractiveWWW::Mechanize::FormFiller::Value::KeepWWW::Mechanize::FormFiller::Value::RandomWWW::Mechanize::FormFiller::Value::Random::WordWWW::Mechanize::FormFiller::Value::Random::CharsWWW::Mechanize::FormFiller::Value::Random::Date
πΈ EXPORT πΈ
None by default. π That's it. That's the export section.
π 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
and that's the whole page bestie, we're done, go fill out some forms π β¨
signing off from perl v5.34.0, dated 2022-08-20 β this was WWW::M...Filler(3pm), mwah π
π¦ where this page comes from
- debian bookworm: libwww-mechanize-formfiller-perl 0.13-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libwww-mechanize-formfiller-perl 0.13-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libwww-mechanize-formfiller-perl 0.13-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libwww-mechanize-formfiller-perl 0.13-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libwww-mechanize-formfiller-perl 0.13-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms