newbie00 has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use the instructions in the following reference:
~~~~~~
ref: http://search.cpan.org/src/UNRTST/Authen-Captcha-1.023/README (see code below)
~~~~~~
I haven't been able to get it to work, though. Here are my questions:
1) where is the value for the var, '$number_of_characters' pre-defined? I added a line in my code that assigns a value to this variable and a few error messages went away. ($number_of_characters = 6;)
2) before entering a value for '$number_of_characters', here is the error that I haven't been able to figure out:
~~~~~~~~~~~~~
~~~~~~~~~~~~~Name "main::code" used only once: possible typo at imgverfn.pl line 23 +. at imgverfn.pl line 23 Name "main::number_of_characters" used only once: possible typo at img +verfn.pl line 18. at imgverfn.pl line 18 main::(imgverfn.pl:9): my $captcha = Authen::Captcha->new(); resize: not found Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COL +UMNS and LINES environment variables didn't work. Theresize program d +idn't work. at /usr/local/lib/perl5/site_perl/5.8.8/mach/Term/ReadKey +.pm line 362. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.8/ +Term/ReadLine/Perl.pm line 63. at /usr/local/lib/perl5/site_perl/5.8.8/Term/ReadLine/Perl.pm line 63 Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x8128b94) +', 'GLOB(0x80f6358)') called at /usr/local/lib/perl5/5.8.8/perl5db.pl + line 6029 DB::setterm called at /usr/local/lib/perl5/5.8.8/perl5db.pl line 2203 DB::DB called at imgverfn.pl line 9
Some of these errors disappeared when I added the '$number_of_characters' value line.
The code from the referenced web page is below. NOTE: I removed the lines related to 'Alternatively':
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~NAME Authen::Captcha - Perl extension for creating captcha's to verify +the human element in transactions. SYNOPSIS use Authen::Captcha; # create a new object my $captcha = Authen::Captcha->new(); # set the data_folder. contains flatfile db to maintain state $captcha->data_folder('/some/folder'); # set directory to hold publicly accessable images $captcha->output_folder('/some/http/folder'); # Alternitively, any of the methods to set variables may also be # used directly in the constructor my $captcha = Authen::Captcha->new( data_folder => '/some/folder', output_folder => '/some/http/folder', ); # create a captcha. Image filename is "$md5sum.png" my $md5sum = $captcha->generate_code($number_of_characters); # check for a valid submitted captcha # $code is the submitted letter combination guess from the use +r # $md5sum is the submitted md5sum from the user (that we gave +them) my $results = $captcha->check_code($code,$md5sum); # $results will be one of: # 1 : Passed # 0 : Code not checked (file error) # -1 : Failed: code expired # -2 : Failed: invalid code (not in database) # -3 : Failed: invalid code (code does not match crypt) ##############
Any thoughts or suggestions? Is using 'GD::SecurityImage' better and easier to install?
(ref: http://cpan.uwinnipeg.ca/htdocs/GD-SecurityImage/GD/SecurityImage.html)
Thanks in advance.
Edited by planetscape - linkified links
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with Authen::Captcha instructions
by shmem (Chancellor) on Jun 29, 2006 at 22:20 UTC | |
|
Re: Need help with Authen::Captcha instructions
by Joost (Canon) on Jun 29, 2006 at 22:26 UTC | |
by newbie00 (Beadle) on Jun 30, 2006 at 01:05 UTC | |
by shmem (Chancellor) on Jun 30, 2006 at 01:52 UTC | |
by newbie00 (Beadle) on Jun 30, 2006 at 03:15 UTC |