HTML::...aptcha(3pm)
πΈ NAME πΈ
Okay bestie, welcome to the HTML::...aptcha(3pm) page from the User Contributed Perl Documentation. This one is all about HTML::FormHandler::TraitFor::Captcha β generate and validate captchas. That's the name, that's the mission, we're moving. π
π¦ VERSION π¦
version 0.40068 β write it down, bestie, that's the version of this little icon. π«Ά
β¨ SYNOPSIS β¨
It's a role you use in a form to implement a captcha field. Two ways to pull up, and both are valid:
package MyApp::Form;
use HTML::FormHandler::Moose;
with 'HTML::FormHandler::TraitFor::Captcha';
or
my $form = MyApp::Form->new( traits => ['HTML::FormHandler::TraitFor::Captcha'],
ctx => $c );
Then the important bit: it needs a context object set in the form's ctx attribute. That context has a session hashref in which to store a captcha hashref β the kind of setup the Catalyst session plugin provides, for example. That's the requirement, periodt. π
π METHODS π
get_captcha
Get a captcha stored in $form->ctx->{session}. Simple. Fetch. Slay. β¨
set_captcha
Set a captcha in $self->ctx->{session}. Put it there, bestie. π
captcha_image_url
The default is '/captcha/image'. Override it in a form to change it. Like this:
sub captcha_image_url { '/my/image/url/' }
Example of a Catalyst action to handle the image:
sub image : Local {
my ( $self, $c ) = @_;
my $captcha = $c->session->{captcha};
$c->response->body($captcha->{image});
$c->response->content_type('image/'. $captcha->{type});
$c->res->headers->expires( time() );
$c->res->headers->header( 'Last-Modified' => HTTP::Date::time2str );
$c->res->headers->header( 'Pragma' => 'no-cache' );
$c->res->headers->header( 'Cache-Control' => 'no-cache' );
}
π AUTHOR π
FormHandler Contributors - see HTML::FormHandler. That's the squad. π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Gerda Shank. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Periodt. π
π Sign-off time: this is the HTML::...aptcha(3pm) page from perl v5.34.0, dated 2022-03-25. Bye bestie, go generate and validate those captchas. π¦
π¦ where this page comes from
- debian bookworm: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms