WWW::M...allback(3pm)

πŸ“¦
version 0.13 Β· 2 versions
  • 0.13 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.12 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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. πŸ€·β™€οΈ

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::Mechanize
  • WWW::Mechanize::Shell
  • WWW::Mechanize::FormFiller
  • WWW::Mechanize::FormFiller::Value::Value
  • WWW::Mechanize::FormFiller::Value::Default
  • WWW::Mechanize::FormFiller::Value::Random
  • WWW::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