| 1 | package WWW::MailboxOrg::JSONRPCResponse; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # ABSTRACT: JSON-RPC 2.0 response object | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 1 | ▶ | use Moo; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.001'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 1 | has result => ( | |||||||||||||||||||
| 11 | is => 'ro', | ||||||||||||||||||||
| 12 | predicate => 'has_result', | ||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | has error => ( | |||||||||||||||||||
| 17 | is => 'ro', | ||||||||||||||||||||
| 18 | predicate => 'has_error', | ||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 1 | has id => ( | |||||||||||||||||||
| 23 | is => 'ro', | ||||||||||||||||||||
| 24 | predicate => 'has_id', | ||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | sub is_success { | ||||||||||||||||||||
| 29 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
is_success: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 30 | 2 | ▶ | return $self->has_result && !$self->has_error; | ||||||||||||||||||
|
Condition66%2/3
$self->has_result && !$self->has_error
MC/DC50%1/2
$self->has_result && !$self->has_error
$self->has_result
!$self->has_error
Truth table66%2/3
A && not(B)
A= $self->has_resultB= !$self->has_error
| |||||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 1 | 1; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | =pod | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =encoding UTF-8 | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =head1 NAME | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | WWW::MailboxOrg::JSONRPCResponse - JSON-RPC 2.0 response object | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | =head1 VERSION | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | version 0.001 | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | =head1 SYNOPSIS | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | use WWW::MailboxOrg::JSONRPCResponse; | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | my $res = WWW::MailboxOrg::JSONRPCResponse->new( | ||||||||||||||||||||
| 55 | result => { account => 'test@example.tld' }, | ||||||||||||||||||||
| 56 | id => 1, | ||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | =head1 DESCRIPTION | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | JSON-RPC 2.0 response object. | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | =head2 result | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | The response result (absent on error). | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | =head2 error | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | Error object with C<code> and C<message> keys. | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | =head2 id | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | Request ID this response corresponds to. | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | =head2 is_success | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | Returns true if the response is successful. | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | =head1 SUPPORT | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | =head2 Issues | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||
| 84 | L<https://github.com/getty/p5-www-mailboxorg/issues>. | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | =head2 IRC | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | Join C<#perl-help> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | =head1 CONTRIBUTING | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | =head1 AUTHOR | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | Torsten Raudssus <getty@cpan.org> | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 103 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | =cut | ||||||||||||||||||||