First page Back Continue Last page Overview Graphics

Coercions

My Code: package BoyosPlace::Email; use Moose; use Moose::Util::TypeConstraints; use Email::Stuff; use Email::Valid; subtype 'Email', as 'Str', where { Email::Valid->address($_) eq $_ }; coerce 'Email', from 'Str', via { scalar Email::Valid->address($_) }; has 'subject' => ( is => 'rw', isa => "Str" ); has 'to' => ( is => 'rw', isa => "Email" ); has 'from' => ( is => 'rw', isa => "Email" ); has 'data' => ( is => 'rw', isa => "Str" );