-
-
19 Jan 2013 00:20:30 UTC
- Distribution: MooX-Types-MooseLike-Email
- Module version: 0.03
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (0)
- Testers (1518 / 1 / 0)
- Kwalitee
Bus factor: 0- 27.86% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (27.77KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Email::Abstract
- Email::Valid
- Email::Valid::Loose
- MooX::Types::MooseLike
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
MooX::Types::MooseLike::Email - Email address validation type constraint for Moo.
SYNOPSIS
package MyClass; use Moo; use MooX::Types::MooseLike::Email qw/:all/; has 'email' => ( isa => EmailAddress, is => 'ro', required => 1 ); has 'message' => ( isa => EmailMessage, is => 'ro', required => 1 );
DESCRIPTION
MooX::Types::MooseLike::Email is Moo type constraints which uses Email::Valid, Email::Valid::Loose and Email::Abstract to check for valid email addresses and messages.
TYPES
EmailAddress
An email address
EmailAddressLoose
An email address, which allows . (dot) before @ (at-mark)
EmailMessage
An object, which is a Mail::Internet, MIME::Entity, Mail::Message, Email::Simple or Email::MIME
TIPS
coerce the attribute
use Scalar::Util qw(blessed); has 'message' => ( is => 'ro', isa => EmailMessage, required => 1, coerce => sub { return ( $_[0] and blessed( $_[0] ) and blessed( $_[0] ) ne 'Regexp' ) ? $_[0] : Email::Simple->new( $_[0] ); }, );
AUTHOR
hayajo <hayajo@cpan.org>
SEE ALSO
MooX::Types::MooseLike, MooseX::Types::Email, MooseX::Types::Email::Loose
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install MooX::Types::MooseLike::Email, copy and paste the appropriate command in to your terminal.
cpanm MooX::Types::MooseLike::Email
perl -MCPAN -e shell install MooX::Types::MooseLike::Email
For more information on module installation, please visit the detailed CPAN module installation guide.