Data::FormValidator::Constraints::Japanese - Japan-Specific Constraints For Data::FormValidator
use Data::FormValidator::Constraints::Japanese qw(:all); my $rv = Data::FormValidator->check(\%input, { hiragana => hiragana(), katakana => katakana(), jp_mobile_email => jp_mobile_email(), jp_imode_email => jp_imode_email(), jp_ezweb_email => jp_ezweb_email(), jp_vodafone_email => jp_vodafone_email(), jp_zip => jp_zip(), jp_length => jp_length(1, 10), }, # or, use the regular functions my $rv = Data::FormValidator->check(\%input, { nihongo => sub { my($dfv, $value) = @_; return match_hiragana($value) && ! match_katakana($value); } });
D::FM::C::Japanese provides you with constraint methods that makes it easier to validate your Japanese input using Data::FormValidator.
Returns a closure that checks if the input is all in hiragana
Returns a closure that checks if the input is all in katakana
Returns a closure that checks if the input is a valid Japanese zipcode (This is probably insufficient for edge cases). It also does not check if the zip code actually exists.
I'm sure there are lots of other constraints. I'll release more upon request, or when I encounter something new to validate. Patches welcome.
Copyright (c) 2006-2007 Daisuke Maki <dmaki@endeworks.jp> All rights reserved.
To install Data::FormValidator::Constraints::Japanese, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::FormValidator::Constraints::Japanese
CPAN shell
perl -MCPAN -e shell install Data::FormValidator::Constraints::Japanese
For more information on module installation, please visit the detailed CPAN module installation guide.