HTML::...llback(3pm)

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

✨ HTML::FormFu::Constraint::Callback ✨

okay bestie, so this is a page from the User Contributed Perl Documentation β€” and it's literally about HTML::FormFu::Constraint::Callback, aka the Code Callback Constraint πŸ’…

version 2.07 btw. noted. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the vibe, in Perl:

$field->constraint({
    type => 'Callback',
    callback => \&foo,
});

---
elements:
  - type: Text
    name: foo
    constraints:
      - type: Callback
        callback: "main::my_constraint"

sub foo {
    my ( $value, $params ) = @_;

    # return true or false
}

like. you hand it a callback. the callback says yes or no. that's the whole gig. slay. πŸ’–


🌸 DESCRIPTION 🌸

so here's what's actually happening under the hood, bestie, listen up:

  • the first argument passed to the callback is the submitted value for the associated field ✨
  • the second argument passed to the callback is a hashref of name/value pairs for all input fields 🌈
ngl this constraint doesn't honour the not() value. like, it just doesn't. not me finding that out the hard way 😭

πŸ‘‘ METHODS πŸ‘‘

πŸ’… callback

  • Arguments: \&code-reference πŸ”₯
  • Arguments: "subroutine-name" πŸ”₯

that's it. that's the method. give it a code ref or give it a subroutine name, both are valid, both are iconic. periodt. ✨


🧚 SEE ALSO 🧚

  • Is a sub-class of, and inherits methods from HTML::FormFu::Constraint πŸ’œ
  • HTML::FormFu πŸ’œ

⭐ 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. πŸ’– (yes, fr fr, go off.)


⭐ AUTHOR ⭐

Carl Franks <cpan@fireartist.com> πŸ’«

(yes there are two AUTHOR sections. the icon himself appears twice. we stan.)


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. 🌸


perl v5.28.1 Β· 2019-01-12 β€” and that's the whole page bestie, go build something cute with it πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from