The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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;

        if ($cap->verify($cgi->param('g-captcha-response',$cgi->address)) {
                # 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.

Returns 1 if passed.

FIELD OPTIONS

Support for the following field options, over what is inherited from HTML::FormHandler::Field

site_key

Required. The site key you get when you create an account on https://www.google.com/recaptcha/

secret_key

Required. The secret key you get when you create an account on https://www.google.com/recaptcha/

theme

Optional. The color theme of the widget. Options are 'light ' or 'dark' (Default: light)

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

See it in action at https://www.httpuptime.com

AUTHOR

Chuck Larson <clarson@cpan.org>

COPYRIGHT & LICENSE

Copyright 2015, Chuck Larson <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.