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:

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

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

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;
ShivtekAuthor Commented:
Thank you,

You seem to be a perl genius!!

Can the captcha automatically display the date?
Recaptcha displays words.

See for details.
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.