Captcha::noCAPTCHA - Simple implementation of Google's noCAPTCHA reCAPTCHA for perl
The following is example usage to include captcha in page.
my $cap = Captcha::noCAPTCHA->new({site_key => "your site key",secret_key => "your secret key"}); my $html = $cap->html; # Include $html in your form page.
The following is example usage to verify captcha response.
my $cap = Captcha::noCAPTCHA->new({site_key => "your site key",secret_key => "your secret key"}); my $cgi = CGI->new; my $captcha_response = $cgi->param('g-recaptcha-response'); if ($cap->verify($captcha_response',$cgi->remote_addr)) { # Process the rest of the form. } else { # Tell user he/she needs to prove his/her humanity. }
Accepts no arguments. Returns CAPTCHA html to be rendered with form.
Required $g_captcha_response. Input parameter from form containing g_captcha_response Optional $users_ip_address.
Returns an array ref of errors if verify call fails. List of possible errors:
missing-input-secret The secret parameter is missing. invalid-input-secret The secret parameter is invalid or malformed. missing-input-response The response parameter is missing. invalid-input-response The response parameter is invalid or malformed. http-tiny-no-response HTTP::Tiny did not return anything. No further information available. status-code-DDD Where DDD is the status code returned from the server. no-content-returned Call was successful, but no content was returned.
Returns the response hashref for the most recent captcha response.
Support for the following field options, over what is inherited from HTML::FormHandler::Field
Required. The site key you get when you create an account on https://www.google.com/recaptcha/
Required. The secret key you get when you create an account on https://www.google.com/recaptcha/
Optional. The color theme of the widget. Options are 'light ' or 'dark' (Default: light)
Optional. When true, includes the <noscript> markup in the rendered html. (Default: false)
Optional. URL to the Google API. Defaults to https://www.google.com/recaptcha/api/siteverify
Optional. Seconds to wait for Google API to respond. Default is 10 seconds.
The following modules or resources may be of interest.
HTML::FormHandlerX::Field::noCAPTCHA
Chuck Larson <clarson@cpan.org>
<clarson@cpan.org>
leejo <leejo@cpan.org>
<leejo@cpan.org>
Copyright 2017, Chuck Larson <chuck+github@endcapsoftwware.com>
<chuck+github@endcapsoftwware.com>
This projects work sponsered by End Cap Software, LLC. http://www.endcapsoftware.com
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Captcha::noCAPTCHA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Captcha::noCAPTCHA
CPAN shell
perl -MCPAN -e shell install Captcha::noCAPTCHA
For more information on module installation, please visit the detailed CPAN module installation guide.