Perl Captcha

Hey Guys,

Just wondering it is possible to create a captcha, using perl for the current system date time..

For example:
Wed Apr 21, 2010, 19:23

This currently is printed with the following code:

sub print_datetime {
      @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
        ;  
      @weekDays =
        qw(Sun Mon Tue Wed Thu Fri Sat Sun);  
      (
            $second,     $minute,    $hour,
            $dayOfMonth, $month,     $yearOffset,
            $dayOfWeek,  $dayOfYear, $daylightSavings
      ) = localtime();
      $year = 1900 + $yearOffset;
      $theTime =
        "$weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year, $hour:$minute";
      return $theTime;
}

$q->h1( "Survey", '<em>', print_datetime(), '</em>' );

I found these two links:

http://search.cpan.org/~unrtst/Authen-Captcha-1.023/Captcha.pm
http://bumblebeeware.com/captcha/

I am unsure if this is possible, so instead of printing the "print_datetime" I could display that perl captcha which would refresh automatically...

Please help

LVL 1
ShivtekAsked:
Who is Participating?
 
TintinCommented:
I think the easiest and quickest way to add captcha support is to use Captcha::ReCAPTCHA.

http://search.cpan.org/~andya/Captcha-reCAPTCHA-0.92/lib/Captcha/reCAPTCHA.pm

Once you've got your key, it requires very little code to implement and isn't dependent on various graphics modules on your system.

BTW, your print_datetime subroutine, could be shorted to

use POSIX 'strftime';

sub print_datetime {
   return strftime "%a %b %d, %Y, %H:%M",localtime;
}
0
 
ShivtekAuthor Commented:
Thank you,

You seem to be a perl genius!!

Can the captcha automatically display the date?
0
 
TintinCommented:
Recaptcha displays words.

See http://recaptcha.net/learnmore.html for details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.