FormValidator::Lite::Constraint::JapaneseMoreというものをかいてみた

FormValidator::Liteで漢字とか記号とかチェックしたいなぁとかおもってなかったのででっちあげた。

use strict;
use warnings;
use utf8;
use CGI;
use FormValidator::Lite;
FormValidator::Lite->load_constraints(qw/JapaneseMore/);

my $validator = FormValidator::Lite->new(
    CGI->new({ name => '鈴木ひでお' })
);

$validator->set_message(
    'name.kanji' => '漢字だけでお願いします。',
);

$validator->check( name => [qw/NOT_NULL KANJI/] );
    
for my $msg ($validator->get_error_messages) {
    print $msg;
}


https://github.com/hiroyukim/FormValidator--Lite--Constraint--JapaneseMore