Hello.

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

( keep:0 edit:19 reap:0 )


In reply to Need help with Authen::Captcha instructions by newbie00

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.