| 1 | package WWW::MailboxOrg::Types; | ||
| 2 | |||
| 3 | # ABSTRACT: Custom types for Mailbox.org API | ||
| 4 | |||
| 5 | 1 | ▶ | use Type::Library -base, -declare => qw( EmailAddress DomainName ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Type::Utils -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Types::Standard -types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 1 | our $VERSION = '0.001'; | |
| 10 | |||
| 11 | 1 | my $meta = __PACKAGE__->meta; | |
| 12 | |||
| 13 | declare EmailAddress, | ||
| 14 | as Str, | ||
| 15 | 1 | ▶ | where { /^[^\s@]+@[^\s@]+\.[^\s@]+$/ }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 0 | ▶ | message { "$_ is not a valid email address" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 17 | |||
| 18 | declare DomainName, | ||
| 19 | as Str, | ||
| 20 | 1 | ▶ | 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
| |||
| 21 | 0 | ▶ | message { "$_ is not a valid domain name" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 22 | |||
| 23 | 1 | __PACKAGE__->meta->make_immutable; | |
| 24 | |||
| 25 | 1 | 1; | |
| 26 | |||
| 27 | __END__ | ||
| 28 | |||
| 29 | =pod | ||
| 30 | |||
| 31 | =encoding UTF-8 | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | WWW::MailboxOrg::Types - Custom types for Mailbox.org API | ||
| 36 | |||
| 37 | =head1 VERSION | ||
| 38 | |||
| 39 | version 0.001 | ||
| 40 | |||
| 41 | =head1 SYNOPSIS | ||
| 42 | |||
| 43 | use WWW::MailboxOrg::Types qw( EmailAddress DomainName ); | ||
| 44 | |||
| 45 | has email => ( is => 'ro', isa => EmailAddress ); | ||
| 46 | has domain => ( is => 'ro', isa => DomainName ); | ||
| 47 | |||
| 48 | =head1 TYPES | ||
| 49 | |||
| 50 | =head2 EmailAddress | ||
| 51 | |||
| 52 | Valid email address format. | ||
| 53 | |||
| 54 | =head2 DomainName | ||
| 55 | |||
| 56 | Valid domain name format. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | =head1 SUPPORT | ||
| 61 | |||
| 62 | =head2 Issues | ||
| 63 | |||
| 64 | Please report bugs and feature requests on GitHub at | ||
| 65 | L<https://github.com/getty/p5-www-mailboxorg/issues>. | ||
| 66 | |||
| 67 | =head2 IRC | ||
| 68 | |||
| 69 | Join C<#perl-help> on C<irc.perl.org> or message Getty directly. | ||
| 70 | |||
| 71 | =head1 CONTRIBUTING | ||
| 72 | |||
| 73 | Contributions are welcome! Please fork the repository and submit a pull request. | ||
| 74 | |||
| 75 | =head1 AUTHOR | ||
| 76 | |||
| 77 | Torsten Raudssus <getty@cpan.org> | ||
| 78 | |||
| 79 | =head1 COPYRIGHT AND LICENSE | ||
| 80 | |||
| 81 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||
| 82 | |||
| 83 | This is free software; you can redistribute it and/or modify it under | ||
| 84 | the same terms as the Perl 5 programming language system itself. | ||
| 85 | |||
| 86 | =cut | ||