1HTML::FormHandler::TraiUtsFeorr:C:oCnatprticbhuat(e3d)PHeTrMlL:D:oFcourmmeHnatnadtlieorn::TraitFor::Captcha(3)
2
3
4

NAME

6       HTML::FormHandler::TraitFor::Captcha - generate and validate captchas
7

VERSION

9       version 0.40068
10

SYNOPSIS

12       A role to use in a form to implement a captcha field.
13
14          package MyApp::Form;
15          use HTML::FormHandler::Moose;
16          with 'HTML::FormHandler::TraitFor::Captcha';
17
18       or
19
20          my $form = MyApp::Form->new( traits => ['HTML::FormHandler::TraitFor::Captcha'],
21              ctx => $c );
22
23       Needs a context object set in the form's 'ctx' attribute which has a
24       session hashref in which to store a 'captcha' hashref, such as is
25       provided by Catalyst session plugin.
26

METHODS

28   get_captcha
29       Get a captcha stored in "$form->ctx->{session}"
30

set_captcha

32       Set a captcha in "$self->ctx->{session}"
33
34   captcha_image_url
35       Default is '/captcha/image'. Override in a form to change.
36
37          sub captcha_image_url { '/my/image/url/' }
38
39       Example of a Catalyst action to handle the image:
40
41           sub image : Local {
42               my ( $self, $c ) = @_;
43               my $captcha = $c->session->{captcha};
44               $c->response->body($captcha->{image});
45               $c->response->content_type('image/'. $captcha->{type});
46               $c->res->headers->expires( time() );
47               $c->res->headers->header( 'Last-Modified' => HTTP::Date::time2str );
48               $c->res->headers->header( 'Pragma'        => 'no-cache' );
49               $c->res->headers->header( 'Cache-Control' => 'no-cache' );
50           }
51

AUTHOR

53       FormHandler Contributors - see HTML::FormHandler
54
56       This software is copyright (c) 2017 by Gerda Shank.
57
58       This is free software; you can redistribute it and/or modify it under
59       the same terms as the Perl 5 programming language system itself.
60
61
62
63perl v5.30.0                      2019-0H7T-M2L6::FormHandler::TraitFor::Captcha(3)
Impressum