| FormValidator-LazyWay documentation | Contained in the FormValidator-LazyWay distribution. |
FormValidator::LazyWay::Rule::Object - object
1 | 0
regular expression
Object#regexp
format : ^\d+$
always true!
Tomohiro Teranishi <tomohiro.teranishi@gmail.com>
| FormValidator-LazyWay documentation | Contained in the FormValidator-LazyWay distribution. |
package FormValidator::LazyWay::Rule::Object; use strict; use warnings; use utf8; sub boolean { my $bool = shift; return 0 unless defined $bool; return $bool =~ /^[01]$/ ? 1 : 0 ; } sub regexp { my $text = shift; my $args = shift; die 'please set format' unless $args->{format}; return $text =~ m/$args->{format}/ ? 1 : 0 ; } sub true { return 1; } 1; __END__