The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gantry::Utils::Captcha - a way to mange captchas

SYNOPSIS

    my $captcha = Gantry::Utils::Captcha->new( 'h2xsg' ); 
    
    $captcha->add( { 
        base_url => $self->doc_rootp() . "/images",
        image    => 'captcha-image-1.jpg',  
        key      => 'chair', 
        label    => 'looks like a chair to me',
        alt_text => 'sometimes it feels reaally good to sit',                 
    } );

    $captcha->add( { 
        base_url  => $self->doc_rootp() . "/images",
        image     => 'captcha-image-2.jpg', 
        key       => 'yoda', 
        label     => 'hrm ... yoda you are',
        alt_text  => 'use the force, Luke',                
    } );

    $captcha->add( {
        base_url  => $self->doc_rootp() . "/images",
        image     => 'captcha-image-3.jpg', 
        key       => 'biking', 
        label     => 'biking is fun',
        alt_text  => 'two wheels and a seat',
    } );

    or 
    
    my $captcha = Gantry::Utils::Captcha->new( 
        'h2xs',
        [
            {
                base_url  => $self->doc_rootp() . "/images",
                image     => 'captcha-image-3.jpg', 
                key       => 'biking', 
                label     => 'biking is fun',
                alt_text  => 'two wheels and a seat',
            }        
        ]
    );

DESCRIPTION

This module is a utility to help with captchas.

METHODS

new( [secret encryption key] )

Standard constructor, call it first.

Requires the following parameter

    secret       # this is your super secret encryption key
add( { ... } )

add a captcha item

Requires the following parameter

     image       # the image i.e. myimage.gif
     key         # the unique key for this captcha
     label       # the question that will appear in the select box

Optional

    alt_text     # the alt text for the image
    base_url     # a base url
shuffle

Shuffle the captchas and set one in the queue

valid( [captcha form param value] );

Tests to the captcha's encrypted string with the key and returns true of false

key

Return the captcha's key for the queued chaptcha

base_url

Returns the captcha's base url for the queued chaptcha

image

Returns the captcha's image for the queued chaptcha

label

Returns the captcha's label for the queued chaptcha

alt_text

Returns the captcha's alt_text for the queued chaptcha

crypt_string

Returns the captcha's crypt_string for the queued chaptcha

gantry_form_options

returns a reference to an array of form options that can be passed directly to form.tt

Returns the captcha's image link

SEE ALSO

Gantry(3)

LIMITATIONS

This module depends on Gantry(3)

AUTHOR

Tim Keefer <tkeefer@gmail.com>

COPYRIGHT and LICENSE

Copyright (c) 2005-7, Tim Keefer.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.