HTML::...traint(3pm)
πΈ NAME πΈ
HTML::Widget::Constraint β Constraint Base Class π
bestie, this is the page for HTML::...traint(3pm) (the manual's own little shorthand for it, don't @ me). It's the base class everything else in the constraint family is built on. π
β¨ SYNOPSIS β¨
my $c = $widget->constraint( $type, @names );
$c->message('Validation error.');
$c->names(@names);
$c->not(1);
π DESCRIPTION π
Constraint Base Class. That's it, that's the whole description. It's the blueprint, the mother of all constraints, the one who gave birth to the rest of them. π«Ά
π METHODS π
π« default_message
- Arguments:
$message - Return Value:
$message
Default error message for failing constraints. Like, when a constraint fails and nobody bothered to set a custom message, this is the one that shows up. The default. The fallback. The "we had nothing better so here" of error messages. π
π« init
- Arguments:
$widget
Called once when process() gets called for the first time. One time only, bestie β the first process() and never again. π
π« javascript
- Arguments:
$id
Should return JavaScript for client side validation and the like. Yes girl, this is where the client-side magic is supposed to go. β¨
π« msg
π« message
- Arguments:
$message
Contains the validation error message. Both names, same job β pick whichever one feels right for your vibe. π
π« mk_message
- Arguments:
$message
Returns a validation error message. It makes the message. Iconic behavior, truly. π
π« names
- Arguments:
@names - Return Value:
@names
Contains names of params to test. These are the ones getting the vibe check. π§
π« not
- Arguments:
$bool - Return Value:
$bool
Negate constraint. Flip it. Whatever the constraint says, do the opposite. Main character energy but make it boolean. π₯
π« prepare
- Arguments:
$widget
Called every time process() gets called. Every. Single. Time. Unlike init, this one shows up to every party, no skipping. π¦
π« process
- Arguments:
$widget,$params,\@uploads - Return Value:
\@errors
Validates params and returns a arrayref containing HTML::Widget::Error objects representing failed constraints. So like, it checks your stuff, and if your stuff failed, you get back a whole arrayref full of little error objects documenting every single way you messed up. No cap. π
π« process_js
- Arguments:
$id
Returns a hashref containing JavaScripts for client side validation and the like. The JS twin of process, basically β hashref flavored. β
π« render_errors
- Arguments:
@names
A list of element names for which an error should be displayed.
If this is not set, the default behaviour is for the error to be displayed for all of the Constraint's named elements. So if you don't say anything, it just shows errors for everything the Constraint is named after. Loud and proud, no filter. π£
π« validate
- Arguments:
$value - Return Value:
$bool
Validates a value and returns 1 or 0. Yes or no. Slay or nay. That's the whole API. π
π AUTHOR π
Sebastian Riedel, "sri@oook.de" β the legend himself. π«Ά
π LICENSE π
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. Free as in bestie, go wild. π
okay and that's the whole page, mwah π β this was perl v5.36.0, dated 2023-08-10, on the HTML::...traint(3pm) manual page. thanks for coming to my ted talk, now 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