Catalyst::Controller::reCAPTCHA - authenticate people and read books!
Catalyst::Controller wrapper around Capatcha::reCAPTCHA. Provides a number of Private methods that deal with the recaptcha.
Private
In MyApp.pm (or equivalent in config file):
__PACKAGE__->config->{recaptcha}->{pub_key} = '6LcsbAAAAAAAAPDSlBaVGXjMo1kJHwUiHzO2TDze'; __PACKAGE__->config->{recaptcha}->{priv_key} = '6LcsbAAAAAAAANQQGqwsnkrTd7QTGRBKQQZwBH-L';
(the two keys above work for http://localhost unless someone hammers the reCAPTCHA server with failures, in which case the API keys get a temporary ban).
captcha_get : Private
Sets $c->stash->{recaptcha} to be the html form for the http://recaptcha.net/ reCAPTCHA service which can be included in your HTML form.
captcha_check : Private
Validates the reCaptcha using Captcha::reCAPTCHA. sets $c->stash->{recaptcha_ok} which will be 1 on success. The action also returns true if there is success. This means you can do:
if ( $c->forward(captcha_check) ) { # do something based on the reCAPTCHA passing }
or alternatively:
if ( $c->stash->{recaptcha_ok} ) { # do something based on the reCAPTCHA passing }
If there's an error, $c->stash->{recaptcha_error} is set with the error string provided by Captcha::reCAPTCHA.
See the t/lib/TestApp example in the Catalyst::Controller::reCAPTCHA distribution.
Captcha::reCAPTCHA, Catalyst::Controller, Catalyst.
Kieren Diment zarquon@cpan.org.
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Controller::reCAPTCHA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Controller::reCAPTCHA
CPAN shell
perl -MCPAN -e shell install Catalyst::Controller::reCAPTCHA
For more information on module installation, please visit the detailed CPAN module installation guide.