HTML::Widget::Constraint::Email - Email Constraint


HTML-Widget documentation Contained in the HTML-Widget distribution.

Index


Code Index:

NAME

Top

HTML::Widget::Constraint::Email - Email Constraint

SYNOPSIS

Top

    my $c = $widget->constraint( 'Email', 'foo' );

DESCRIPTION

Top

Email Constraint.

METHODS

Top

validate

AUTHOR

Top

Sebastian Riedel, sri@oook.de

LICENSE

Top

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


HTML-Widget documentation Contained in the HTML-Widget distribution.
package HTML::Widget::Constraint::Email;

use warnings;
use strict;
use base 'HTML::Widget::Constraint';
use Email::Valid;

sub validate {
    my ( $self, $value ) = @_;
    return 1 unless $value;
    return 0 unless Email::Valid->address( -address => $value );
    return 1;
}

1;