HTML::...ckOnce(3pm)
π NAME π
HTML::Widget::Constraint::CallbackOnce β it's the CallbackOnce Constraint, and yes she's from the HTML::...ckOnce(3pm) manual, we love her, no cap π«Ά
β¨ SYNOPSIS β¨
my $c = $widget->constraint( 'CallbackOnce', 'foo', 'bar' )->callback(
sub {
my ($foo, $bar) = @_;
return 1 if $foo == $bar * 2;
});
okay so that's literally it, you hand her a sub and she runs it. iconic behaviour fr fr π
πΈ DESCRIPTION πΈ
So bestie, here's the tea: this is a callback constraint β but plot twist β it only gets run once for each call of process in HTML::Widget. Not twice. Not "hmm let me think about it again." Once. She said main character energy only, we're not doing reruns πβ¨
π METHODS π
callback
cb
Arguments: \&callback
You require a subroutine reference here, and that's the thing doing your validation. When she calls it, she passes along a list of values that correspond to the constraint names. So like, the names you gave, the values show up in that same order. slay π§
Also β cb is provided as an alias to callback. Same girl, two nicknames, we contain multitudes π
process
This one overrides process in HTML::Widget::Constraint, and the whole point is to make sure validate is only called once for each call of validate. That's the assignment. That's the mission. periodt π
render_errors
Arguments: @names
A list of element names for which an error should be displayed. Like, where do you want the sad little error message to show up, bestie?
If this is not set, the default behaviour is for the error to be displayed for all of the Constraint's named elements. Every single one. She's thorough like that π¦
validate
perform the actual validation.
like, do the thing. the real work. the moment. the β¨validationβ¨ π₯
π AUTHOR π
Carl Franks cfranks@cpan.org
(legend behaviour, we stan ππ)
π LICENSE π
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. So go off, remix her, she's free π πΈ
and that's the whole page, bestie!! π written up as part of the User Contributed Perl Documentation, perl v5.36.0, dated 2023-08-10. mwah, go validate something πβ¨
π¦ where this page comes from
- debian trixie: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-widget-perl 1.11-7 Β· 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