Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my $profile = {
- is => 'rw',
- isa => 'HashRef',
- default => sub {
- my $self = shift;
- return {
- target => {
- required => 1,
- type => 'Str',
- post_check => sub {
- my $r = shift;
- my $value = $r->get_value('target');
- my $ok = $value =~ /all|email|id/ ? 1 : 0;
- return $ok;
- },
- },
- email => {
- required => 0,
- type => 'Str',
- post_check => sub {
- my $r = shift;
- use Email::Valid;
- my $value = $r->get_value('email');
- my $ok = Email::Valid->address($value) ? 1 : 0;
- return $ok;
- },
- },
- id => {
- required => 0,
- type => 'Int',
- },
- },
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement