|$captcha = Authen::Captcha->new();||
This creates a new Captcha object.
Optionally, you can pass in a hash with configuration information.
See the method descriptions for more detail on what they mean.
|$token = $captcha->generate_code( $number_of_characters );||
Creates a captcha. Image filename is $token.png
It can also be called in array context to retrieve the string of characters used to generate the captcha (the string the user is expected to respond with). This is useful for debugging. ex.
($token,$chars) = $captcha->generate_code( $number_of_characters );
|$results = $captcha->check_code($code,$token);||
check for a valid submitted captcha
$code is the submitted letter combination guess from the user
$token is the submitted token from the user (that we gave them)
If the $code and $token are correct, the image file and database entry will be removed.
If the $token matches one in the database, and keep_failures is false (the default), the image file and database entry will be removed to avoid repeated attempts on the same captcha.
$results will be one of:
$captcha->data_folder( /some/folder ); Required. Sets the directory to hold the flatfile database that will be used to store the current non-expired valid captcha tokens. Must be writable by the process running the script (usually the web server user, which is usually either apache or http), but should not be accessible to the end user. $captcha->output_folder( /some/folder ); Required. Sets the directory to hold the generated Captcha image files. This is usually a web accessible directory so that the user can view the images in here, but it doesnt have to be web accessible (you could be attaching the images to an e-mail for some verification, or some other Captcha implementation). Must be writable by the process running the script (usually the web server user, which is usually either apache or http). $captcha->images_folder( /some/folder ); Optional, and may greatly affect the results... use with caution. Allows you to override the default character graphic pngs and backgrounds with your own set of graphics. These are used in the generation of the final captcha image file. The defaults are held in:
[lib install dir]/Authen/Captcha/images
$captcha->expire( 300 ); Optional. Sets the number of seconds this captcha will remain valid. This means that the created captchas will not remain valid forever, just as long as you want them to be active. Set to an appropriate value for your application. Defaults to 300. $captcha->width( 25 ); Optional. Number of pixels high for the character graphics. Defaults to 25. $captcha->height( 35 ); Optional. Number of pixels wide for the character graphics. Defaults to 35. $captcha->keep_failures( [0|1] ); Optional. Defaults to zero. This option controls whether or not the captcha will remain valid after a failed attempt. By default, we only allow one attempt to solve it. This greatly reduces the possibility that a bot could brute force a correct answer. Change it at your own risk. $captcha->debug( [0|1|2] ); Optional. Sets the debugging bit. 1 turns it on, 0 turns it off. 2 will print out verbose messages to STDERR.
sound file captcha: Incorporating distorted sound file creation.
The Captcha project:
The origonal perl script this came from:
Seth T. Jackson, <firstname.lastname@example.org>
Josh I. Miller, <email@example.com>
First Productions, Inc. created the cgi-script distributed under the GPL which was used as the basis for this module. Much work has gone into making this more robust, and suitable for other applications, but much of the origonal code remains.
Fixes were reported and contributed by various people, see Changes file for a complete list.
Copyright 2003, First Productions, Inc. (FIRSTPRODUCTIONS HUMAN TEST 1.0)
Copyright 2003 by Seth Jackson
Copyright 2012 by Paolo Rossi, Lubomir Rintel, Chris Dunlop, Gert Schepens and Ernesto Herna\k:' |\n:undez-Novich
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. (see license.txt).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 764: Non-ASCII character seen before =encoding in Herna\k:'Assuming UTF-8
|perl v5.20.3||CAPTCHA (3)||2014-03-12|