---
name: "Catalyst::Plugin::Captcha"
section: "3pm"
platform: "linux"
package: "libcatalyst-plugin-captcha-perl"
version: "0.04-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catalyst::Plugin::Captcha"
---

# Catalyst::Plugin::Captcha(3pm)

create and validate Captcha for Catalyst

## NAME

Catalyst::Plugin::Captcha - create and validate Captcha for Catalyst

## SYNOPSIS

```
  use Catalyst qw/Captcha/;
  MyApp->config->{ 'Plugin::Captcha' } = {
    session_name => 'captcha_string',
    new => {
      width => 80,
      height => 30,
      lines => 7,
      gd_font => 'giant',
    },
    create => [qw/normal rect/],
    particle => [100],
    out => {force => 'jpeg'}
  };
  sub captcha : Local {
    my ($self, $c) = @_;
    $c->create_captcha();
  }
  sub do_post : Local {
    my ($self, $c) = @_;
    if ($c->validate_captcha($c->req->param('validate')){
      ..
    } else {
      ..
    }
  }
  #validate with CP::FormValidator::Simple
  sub do_post : Local {
    my ($self, $c) = @_;
    $c->form(
      validate => [['EQUAL_TO',$c->captcha_string]]
    )
  }
```

## DESCRIPTION

This plugin create, validate Captcha.

Note: This plugin uses GD::SecurityImage and requires a session plugins like Catalyst::Plugin::Session

## METHODS

### create\_captcha

Create Captcha image and output it.

### validate\_captcha

```
  $c->validate_captcha($key);
```

validate key

### captcha\_string

Return a string for validation which is stroed in session.

### clear\_captcha\_string

Clear a string which is stroed in session.

## CONFIGURATION

- session\_name

  The keyword for storing captcha string

- new

  - create

  - particle

  - out

  These parameters are passed to each GD::Security's method. Please see GD::SecurityImage for details.

## SEE ALSO

GD::SecurityImage, Catalyst

## AUTHOR

Masahiro Nagano \<kazeburo@nomadscafe.jp\>

## COPYRIGHT AND LICENSE

Copyright (C) 2006 by Masahiro Nagano

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.5 or, at your option, any later version of Perl 5 you may have available.
