GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::FormHandler::TraitFor::Captcha(3) User Contributed Perl Documentation HTML::FormHandler::TraitFor::Captcha(3)

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

version 0.40068

A role to use in a form to implement a captcha field.

   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 );

Needs a context object set in the form's 'ctx' attribute which has a session hashref in which to store a 'captcha' hashref, such as is provided by Catalyst session plugin.

Get a captcha stored in "$form->ctx->{session}"

Set a captcha in "$self->ctx->{session}"

Default is '/captcha/image'. Override in a form to change.

   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' );
    }

FormHandler Contributors - see HTML::FormHandler

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.

2017-07-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.