WWW::M...allback(3pm)
π WWW::Mechanize::FormFiller::Value::Callback π
okay so bestie, welcome to WWW::Mechanize::FormFiller::Value::Callback (3pm, she's a Perl module, she's iconic). This is the part of the Mechanize form-filling fam where you get to run Perl code and have whatever it returns land in a HTML form field. no cap. π
β¨ NAME β¨
WWW::Mechanize::FormFiller::Value::Callback β call actual Perl code to fill out a HTML form field. it's giving "I don't do static values, I do vibes computed at runtime". π¦
πΈ SYNOPSIS πΈ
use WWW::Mechanize::FormFiller;
use WWW::Mechanize::FormFiller::Value::Callback;
my $f = WWW::Mechanize::FormFiller->new();
# Create a default value for the HTML field "login"
# This will put the current login name into the login field
sub find_login {
getlogin || getpwuid($<) || "Kilroy";
};
my $login = WWW::Mechanize::FormFiller::Value::Callback->new( login => \&find_login );
$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 nice number there
my $password = $f->add_filler( password => Callback => sub { int rand(90) + 10 } );
like. look at that. find_login literally fishes your login out of the system, and if that fails it goes "Kilroy". main character energy fr fr. π
π DESCRIPTION π
This class is your lil hookup for writing a value returned by Perl code straight into a HTML field. your code, your rules, your field. slay.
π«Ά new NAME, CODE
Makes a brand-new value that corresponds to the HTML field "NAME". The CODE is a code reference that returns the value you want written into that HTML field. Heads up though: that code reference gets called with two parameters β the object, and the HTML::Form::Input object. both. every time. don't forget the second one bestie. π
π name [NEWNAME]
Gets and sets the name of the HTML field this value corresponds to. give it a NEWNAME and it changes; don't and it just tells you what it is. lowkey handy.
β value FIELD
Returns the value to put into the HTML field. that's the whole job. she delivers. β¨
π EXPORT
None by default. like, zero. nothing gets exported unless you ask. π€·βοΈ
π 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 !
not me asking you to send tests π₯Ί pls. the module is literally begging. bugs? improvements? tests? all welcome, all appreciated. π
π¦ SEE ALSO π¦
WWW::MechanizeWWW::Mechanize::ShellWWW::Mechanize::FormFillerWWW::Mechanize::FormFiller::Value::ValueWWW::Mechanize::FormFiller::Value::DefaultWWW::Mechanize::FormFiller::Value::RandomWWW::Mechanize::FormFiller::Value::Interactive
and that's the whole page bestie π this one shipped as perl v5.34.0, dated 2022-08-20, straight from the User Contributed Perl Documentation. obsessed. periodt. πβ¨
π¦ 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