HTML::...allback(3pm)

πŸ“¦
version 2.07000 Β· 5 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– 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 ✨


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