https://github.com/clarson/captcha-nocaptcha
Simple Google's noCAPTCHA reCAPTCHA for perl
https://github.com/clarson/captcha-nocaptcha
Last synced: 8 months ago
JSON representation
Simple Google's noCAPTCHA reCAPTCHA for perl
- Host: GitHub
- URL: https://github.com/clarson/captcha-nocaptcha
- Owner: clarson
- Created: 2015-01-10T22:32:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-07-06T18:37:50.000Z (almost 9 years ago)
- Last Synced: 2025-10-22T07:56:36.251Z (8 months ago)
- Language: Perl
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NAME
Captcha::noCAPTCHA - Simple implementation of Google's noCAPTCHA reCAPTCHA for perl
# SYNOPSIS
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.
}
# METHODS
## html
Accepts no arguments. Returns CAPTCHA html to be rendered with form.
## verify($g\_captcha\_response,$users\_ip\_address?)
Required $g\_captcha\_response. Input parameter from form containing g\_captcha\_response
Optional $users\_ip\_address.
## errors()
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.
## response()
Returns the response hashref for the most recent captcha response.
# FIELD OPTIONS
Support for the following field options, over what is inherited from
[HTML::FormHandler::Field](https://metacpan.org/pod/HTML::FormHandler::Field)
## site\_key
Required. The site key you get when you create an account on [https://www.google.com/recaptcha/](https://www.google.com/recaptcha/)
## secret\_key
Required. The secret key you get when you create an account on [https://www.google.com/recaptcha/](https://www.google.com/recaptcha/)
## theme
Optional. The color theme of the widget. Options are 'light ' or 'dark' (Default: light)
## noscript
Optional. When true, includes the markup in the rendered html. (Default: false)
## api\_url
Optional. URL to the Google API. Defaults to https://www.google.com/recaptcha/api/siteverify
## api\_timeout
Optional. Seconds to wait for Google API to respond. Default is 10 seconds.
# SEE ALSO
The following modules or resources may be of interest.
[HTML::FormHandlerX::Field::noCAPTCHA](https://metacpan.org/pod/HTML::FormHandlerX::Field::noCAPTCHA)
# AUTHOR
Chuck Larson ``
# CONTRIBUTORS
leejo ``
# COPYRIGHT & LICENSE
Copyright 2017, Chuck Larson ``
This projects work sponsered by End Cap Software, LLC.
[http://www.endcapsoftware.com](http://www.endcapsoftware.com)
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.