SYNOPSIS of Plugin::FormValidator::Simple::Auto

use Catalyst qw/ FormValidator::Simple FormValidator::Simple::Auto /;

__PACKAGE__->config(
    validator => {
        messages => 'messages.yml',
        profiles => 'profiles.yml',
        # and other FormValidator::Simple config
    },
);


# profiles.yml
action1:
  param1:
    - NOT_BLANK
    - ASCII
    - [ 'LENGTH', 4, 10 ]
  param2:
    - NOT_BLANK


# then your action
sub action1 : Global {
    my ($self, $c) = @_;

    # $c->form($profile) already executed!
    unless ($c->form->has_error) {
        ...
    }
}

とか言うのを作ろうかと。

牧さんのパクリ。

by typester / at 2006-06-13T21:45:00 / perl · catalyst / Comments(0)