| 1 | package WWW::MailboxOrg::API::Validate; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Validation API | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooX::Singleton; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Params::ValidationCompiler qw(validation_for); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Types::Standard qw(Str); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = '0.001'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has client => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | weak_ref => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | sub _rpc { | ||||||||||
| 20 | 0 | ▶ | my ($self, $method, @params) = @_; | ||||||||
|
Subroutine
_rpc: not called CC=2 SCAR=17.9
| |||||||||||
| 21 | 0 | ▶ | my $client = $self->client or croak "No client set"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | return $client->call($method, @params); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 1 | my %validators = ( | |||||||||
| 26 | email => validation_for( | ||||||||||
| 27 | params => { | ||||||||||
| 28 | email => { type => Str, optional => 0 }, | ||||||||||
| 29 | }, | ||||||||||
| 30 | ), | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | sub email { | ||||||||||
| 34 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
email: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 35 | 0 | my $v = $validators{'email'}; | |||||||||
| 36 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | return $self->_rpc('validate.email', \%params); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||
| 43 | |||||||||||
| 44 | =pod | ||||||||||
| 45 | |||||||||||
| 46 | =encoding UTF-8 | ||||||||||
| 47 | |||||||||||
| 48 | =head1 NAME | ||||||||||
| 49 | |||||||||||
| 50 | WWW::MailboxOrg::API::Validate - Validation API | ||||||||||
| 51 | |||||||||||
| 52 | =head1 VERSION | ||||||||||
| 53 | |||||||||||
| 54 | version 0.001 | ||||||||||
| 55 | |||||||||||
| 56 | =head1 NAME | ||||||||||
| 57 | |||||||||||
| 58 | WWW::MailboxOrg::API::Validate - Validation API | ||||||||||
| 59 | |||||||||||
| 60 | =head2 email | ||||||||||
| 61 | |||||||||||
| 62 | my $result = $api->validate->email(email => 'user@example.com'); | ||||||||||
| 63 | |||||||||||
| 64 | Validate an email address. Required: C<email>. | ||||||||||
| 65 | |||||||||||
| 66 | =cut | ||||||||||
| 67 | |||||||||||
| 68 | =head1 SUPPORT | ||||||||||
| 69 | |||||||||||
| 70 | =head2 Issues | ||||||||||
| 71 | |||||||||||
| 72 | Please report bugs and feature requests on GitHub at | ||||||||||
| 73 | L<https://github.com/getty/p5-www-mailboxorg/issues>. | ||||||||||
| 74 | |||||||||||
| 75 | =head2 IRC | ||||||||||
| 76 | |||||||||||
| 77 | Join C<#perl-help> on C<irc.perl.org> or message Getty directly. | ||||||||||
| 78 | |||||||||||
| 79 | =head1 CONTRIBUTING | ||||||||||
| 80 | |||||||||||
| 81 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||
| 82 | |||||||||||
| 83 | =head1 AUTHOR | ||||||||||
| 84 | |||||||||||
| 85 | Torsten Raudssus <getty@cpan.org> | ||||||||||
| 86 | |||||||||||
| 87 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 88 | |||||||||||
| 89 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||||||||||
| 90 | |||||||||||
| 91 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 92 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 93 | |||||||||||
| 94 | =cut | ||||||||||