1Captcha::reCAPTCHA(3) User Contributed Perl DocumentationCaptcha::reCAPTCHA(3)
2
3
4

NAME

6       Captcha::reCAPTCHA - A Perl implementation of the reCAPTCHA API
7

VERSION

9       This document describes Captcha::reCAPTCHA version 0.93
10

SYNOPSIS

12           use Captcha::reCAPTCHA;
13
14           my $c = Captcha::reCAPTCHA->new;
15
16           # Output form
17           print $c->get_html( 'your public key here' );
18
19           # Verify submission
20           my $result = $c->check_answer(
21               'your private key here', $ENV{'REMOTE_ADDR'},
22               $challenge, $response
23           );
24
25           if ( $result->{is_valid} ) {
26               print "Yes!";
27           }
28           else {
29               # Error
30               $error = $result->{error};
31           }
32
33       For complete examples see the /examples subdirectory
34

DESCRIPTION

36       reCAPTCHA is a hybrid mechanical turk and captcha that allows visitors
37       who complete the captcha to assist in the digitization of books.
38
39       From <http://recaptcha.net/learnmore.html>:
40
41           reCAPTCHA improves the process of digitizing books by sending words that
42           cannot be read by computers to the Web in the form of CAPTCHAs for
43           humans to decipher. More specifically, each word that cannot be read
44           correctly by OCR is placed on an image and used as a CAPTCHA. This is
45           possible because most OCR programs alert you when a word cannot be read
46           correctly.
47
48       This Perl implementation is modelled on the PHP interface that can be
49       found here:
50
51       <http://recaptcha.net/plugins/php/>
52
53       To use reCAPTCHA you need to register your site here:
54
55       <https://www.google.com/recaptcha/admin/create>
56

INTERFACE

58       "new"
59           Create a new "Captcha::reCAPTCHA".
60
61       "get_html( $pubkey, $error, $use_ssl, $options )"
62           Generates HTML to display the captcha.
63
64               print $captcha->get_html( $PUB, $err );
65
66           $pubkey
67               Your reCAPTCHA public key, from the API Signup Page
68
69           $error
70               Optional. If set this should be either a string containing a
71               reCAPTCHA status code or a result hash as returned by
72               "check_answer".
73
74           $use_ssl
75               Optional. Should the SSL-based API be used? If you are
76               displaying a page to the user over SSL, be sure to set this to
77               true so an error dialog doesn't come up in the user's browser.
78
79           $options
80               Optional. A reference to a hash of options for the captcha. See
81               "get_options_setter" for more details.
82
83           Returns a string containing the HTML that should be used to display
84           the captcha.
85
86       "get_options_setter( $options )"
87           You can optionally customize the look of the reCAPTCHA widget with
88           some JavaScript settings. "get_options_setter" returns a block of
89           Javascript wrapped in <script> .. </script> tags that will set the
90           options to be used by the widget.
91
92           $options is a reference to a hash that may contain the following
93           keys:
94
95           "theme"
96               Defines which theme to use for reCAPTCHA. Possible values are
97               'red', 'white' or 'blackglass'. The default is 'red'.
98
99           "tabindex"
100               Sets a tabindex for the reCAPTCHA text box. If other elements
101               in the form use a tabindex, this should be set so that
102               navigation is easier for the user. Default: 0.
103
104       "check_answer"
105           After the user has filled out the HTML form, including their answer
106           for the CAPTCHA, use "check_answer" to check their answer when they
107           submit the form. The user's answer will be in two form fields,
108           recaptcha_challenge_field and recaptcha_response_field. The
109           reCAPTCHA library will make an HTTP request to the reCAPTCHA server
110           and verify the user's answer.
111
112           $privkey
113               Your reCAPTCHA private key, from the API Signup Page.
114
115           $remoteip
116               The user's IP address, in the format 192.168.0.1.
117
118           $challenge
119               The value of the form field recaptcha_challenge_field
120
121           $response
122               The value of the form field recaptcha_response_field.
123
124           Returns a reference to a hash containing two fields: "is_valid" and
125           "error".
126
127               my $result = $c->check_answer(
128                   'your private key here', $ENV{'REMOTE_ADDR'},
129                   $challenge, $response
130               );
131
132               if ( $result->{is_valid} ) {
133                   print "Yes!";
134               }
135               else {
136                   # Error
137                   $error = $result->{error};
138               }
139
140           See the /examples subdirectory for examples of how to call
141           "check_answer".
142

CONFIGURATION AND ENVIRONMENT

144       Captcha::reCAPTCHA requires no configuration files or environment
145       variables.
146
147       To use reCAPTCHA sign up for a key pair here:
148
149       <https://www.google.com/recaptcha/admin/create>
150

DEPENDENCIES

152       LWP::UserAgent, HTML::Tiny
153

INCOMPATIBILITIES

155       None reported .
156

BUGS AND LIMITATIONS

158       No bugs have been reported.
159
160       Please report any bugs or feature requests to
161       "bug-captcha-recaptcha@rt.cpan.org", or through the web interface at
162       <http://rt.cpan.org>.
163

AUTHOR

165       Andy Armstrong  "<andy@hexten.net>"
166
168       Copyright (c) 2007, Andy Armstrong "<andy@hexten.net>". All rights
169       reserved.
170
171       This module is free software; you can redistribute it and/or modify it
172       under the same terms as Perl itself. See perlartistic.
173

DISCLAIMER OF WARRANTY

175       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
176       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
177       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
178       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
179       EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
180       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
181       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
182       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
183       NECESSARY SERVICING, REPAIR, OR CORRECTION.
184
185       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
186       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
187       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
188       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
189       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
190       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
191       RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
192       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
193       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
194       DAMAGES.
195
196
197
198perl v5.12.1                      2010-07-03             Captcha::reCAPTCHA(3)
Impressum