HTML::...allback(3pm)
π HTML::FormFu::Validator::Callback π
okay bestie, gather round, because we're talking about HTML::FormFu::Validator::Callback β the Callback validator from the HTML::FormFu universe (that's the 3pm manual, iykyk). it's giving "plug your own lil function in and let it do the vibe check on your form" β¨
πΈ VERSION πΈ
version 2.07 β that's the one, no cap π
β¨ SYNOPSIS β¨
here's the whole mood, in Perl:
$field->validator('Callback')->callback( \&my_validator );
and if YAML is more your era (it is, honestly), you can do the same thing like this:
---
elements:
- type: Text
name: foo
validators:
- type: Callback
callback: "main::my_validator"
so either you hand it a code ref, or you name-drop a subroutine by string. both work, both slay π«Ά
π¦ DESCRIPTION π¦
Callback validator. that's the whole pitch, but lemme give you the deets because the details are the moment:
- the first argument passed to the callback is the submitted value for the associated field β like, the actual thing your user typed in, that specific field's data π
- the second argument passed to the callback is a hashref of name/value pairs for all input fields β so the whole form's tea, every field, name β value π
that's it. that's the entire job description. you write the function, it gets the value and the whole form, and it does whatever judgment call you want. main character energy, honestly π
π METHODS π
π callback
Arguments: \&code-reference
Arguments: "subroutine-name"
yep, two flavors, both iconic:
- a code reference, like
\&code-referenceβ you're passing the function itself, live and in person π - a subroutine name as a string, like
"subroutine-name"β you're just telling it where to find the function, and it'll go get it
pick your fighter. either way, that's the callback that's gonna run. periodt β¨
π« SEE ALSO π«
- it's a sub-class of, and inherits methods from,
HTML::FormFu::Validatorβ so go read that too, bestie, that's where the family traits live π§ HTML::FormFuβ the mothership, the whole reason any of this exists π
πΈ AUTHOR πΈ
Carl Franks cfranks@cpan.org π
π¦ LICENSE π¦
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. (translation: go off, just play nice, fr fr π)
π AUTHOR π
Carl Franks <cpan@fireartist.com> β yes, same legend, different email, we love a two-for-one β¨
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2018 by Carl Franks. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π«Ά
okay that's the whole page, no skips, no cuts, every single line accounted for π―
and for the cute sign-off: this lil masterpiece came from perl v5.28.1, dated 2019-01-12, and it's filed under HTML::FormFu::Validator::Callback(3pm) β stan a manual page that knows exactly what it is πβ¨π
π¦ where this page comes from
- debian bookworm: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formfu-perl 2.07000-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