| blib/lib/WebService/Mattermost/Role/Returns.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| statement | 7 | 7 | 100.0 |
| branch | n/a | ||
| condition | n/a | ||
| subroutine | 2 | 2 | 100.0 |
| pod | 1 | 1 | 100.0 |
| total | 10 | 10 | 100.0 |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package WebService::Mattermost::Role::Returns; 2: 3: # ABSTRACT: Standard returns for user-facing subroutines. 4: 5: use Moo::Role; 6: 7: ################################################################################ 8: 9: sub error_return { 10: my $self = shift; 11: my $error = shift; 12: 13: $error = sprintf '%s. No API query was made.', $error; 14: 15: return { error => 1, message => $error }; 16: } 17: 18: ################################################################################ 19: 20: 1; 21: 22: __END__ 23: 24: =pod 25: 26: =encoding UTF-8 27: 28: =head1 NAME 29: 30: WebService::Mattermost::Role::Returns - Standard returns for user-facing subroutines. 31: 32: =head1 VERSION 33: 34: version 0.28 35: 36: =head1 DESCRIPTION 37: 38: Common structures for return values. 39: 40: =head2 METHODS 41: 42: =over 4 43: 44: =item C<error_return()> 45: 46: Return an unsuccessful response with an error message. 47: 48: return $self->error_return('Error here'); 49: 50: # \{ 51: # error => 1, 52: # message => 'Error here. No API query was made.', 53: # } 54: 55: =back 56: 57: =head1 AUTHOR 58: 59: Mike Jones <mike@netsplit.org.uk> 60: 61: =head1 COPYRIGHT AND LICENSE 62: 63: This software is Copyright (c) 2020 by Mike Jones. 64: 65: This is free software, licensed under: 66: 67: The MIT (X11) License 68: 69: =cut 70: |