| 1 | package WWW::MailboxOrg::Types; | ||
| 2 | |||
| 3 | # ABSTRACT: Custom types for Mailbox.org API | ||
| 4 | |||
| 5 | 5 | ▶ | use Type::Library -base, -declare => qw( EmailAddress DomainName ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 5 | ▶ | use Type::Utils -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 5 | ▶ | use Types::Standard -types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 5 | my $meta = __PACKAGE__->meta; | |
| 10 | |||
| 11 | declare EmailAddress, | ||
| 12 | as Str, | ||
| 13 | 12 | ▶ | where { /^[^\s@]+@[^\s@]+\.[^\s@]+$/ }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 14 | 1 | ▶ | message { "$_ is not a valid email address" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | declare DomainName, | ||
| 17 | as Str, | ||
| 18 | 11 | ▶ | where { /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/ }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 1 | ▶ | message { "$_ is not a valid domain name" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 5 | __PACKAGE__->meta->make_immutable; | |
| 22 | |||
| 23 | 5 | 1; | |
| 24 | |||
| 25 | __END__ | ||