HTML::...lidator(3pm)
π NAME π
okay bestie, gather round β this is HTML::FormFu::Validator, the Validator Base Class. it's giving "the blueprint all the other validators are built on" energy. iconic behavior honestly. β¨
πΈ VERSION πΈ
this is version 2.07, no cap. that's the one you're looking at right now. π
π¦ SYNOPSIS π¦
bestie... there is literally nothing here. the synopsis is empty. like, the vibe is immaculate but the content said "not today". π moving on, we respect the silence.
π DESCRIPTION π
also empty!! nothing!! the description section is a blank canvas, a vibe check that came back with no notes. π«Ά keep scrolling, the good stuff is down there.
β¨ METHODS β¨
yeah so... also no methods listed here. empty. a whole mood. π
π CORE VALIDATORS π
this is the part where it actually tells you something, and what it tells you is:
HTML::FormFu::Validator::Callbackβ that's it, that's the whole list. one core validator. the main character. π₯
π BEST PRACTICES π
ok so, real talk β try to avoid using callbacks if you can. π
there's a better way, and it's more maintainable, more reusable, and it keeps all your code out of the controller. which is a whole glow-up. periodt.
a normal application's directory would have all this:
lib/HTML/FormFu/Constraint/MyApp/
lib/HTML/FormFu/Validator/MyApp/
lib/HTML/FormFu/Plugin/MyApp/
etc.
so then your form config file only needs this little cutie:
validator: 'MyApp::SomeValidator'
and the class itself would be something like:
package HTML::FormFu::Validator::MyApp::SomeValidator;
use Moose;
extends 'HTML::FormFu::Validator';
sub validate_value {
my ( $self, $value, $params ) = @_;
my $c = $self->form->stash->{context};
return 1 if $c->model('DBIC')->is_valid($value);
# assuming you want to return a custom error message
# which perhaps includes something retrieved from the model
# otherwise, just return 0
die HTML::FormFu::Exception::Validator->new({
message => 'custom error message',
});
}
1;
see? clean. organized. she understood the assignment. π§
π AUTHOR π
Carl Franks, "cfranks@cpan.org" β the legend themselves. π«Ά
β LICENSE β
this library is free software, bestie β you can redistribute it and/or modify it under the same terms as Perl itself. slay. π
πΈ AUTHOR πΈ
again, but make it email-flavored: Carl Franks <cpan@fireartist.com>. two whole ways to reach the icon. π
π₯ COPYRIGHT AND LICENSE π₯
this software is copyright (c) 2018 by Carl Franks.
and yep β this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so generous, so iconic, so real of them. β¨
and that's the whole page, bestie!! this was pulled from perl v5.28.1, dated 2019-01-12 β shoutout to the archive, and to the HTML::...lidator(3pm) manual page for being exactly what it is. π¦ mwah. π
π¦ 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