blib/lib/WG/API/Error.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 100% 6 / 6 totaltotal 95.5% 43 / 45 CC 2 SCAR 2.4
CC
2
Cov
97%
new
2.0
raw
2.0
BEGIN
1.0
CRAP 1.3
« _build/lib/MyBuilder.pm ↑ Summary blib/lib/WG/API/WoWs.pm »
1 package WG::API::Error;
2  
3 5 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 WG::API::Error - module for work with API error
10  
11 =head1 VERSION
12  
13 Version v0.05
14  
15 =cut
16  
17 5 our $VERSION = 'v0.05';
18  
19  
20 =head1 SYNOPSIS
21  
22 Quick summary of what the module does.
23  
24 Perhaps a little code snippet.
25  
26 use WG::API::Error;
27  
28 my $wg_error = WG::API::Error->new();
29 ...
30 say $wg_error->code;
31  
32  
33 =head1 CONSTRUCTOR
34  
35 =head2 new
36  
37 Create new error object.
38  
39 =cut
40  
41 sub new {
42 3 ▶ my $class = shift;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
43
44 3 my $self = {};
45 3 ▶ bless $self, ref( $class ) ? ref( $class ) : $class;
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 1 2 3
46  
47 3 $self->_parse( @_ );
48  
49 3 return $self;
50 }
51  
52 =head2 METHODS
53  
54 =head3 code
55  
56 Return error code.
57  
58 =cut
59  
60 2 ▶sub code { shift->{ 'code' } }
Subroutine code: called CC=1 SCAR=0.0
Pod documented
61  
62 =head3 message
63  
64 Return error message.
65  
66 =cut
67  
68 2 ▶sub message { shift->{ 'message' } }
Subroutine message: called CC=1 SCAR=0.0
Pod documented
69  
70 =head3 field
71  
72 Return error field.
73  
74 =cut
75  
76 2 ▶sub field { shift->{ 'field' } }
Subroutine field: called CC=1 SCAR=0.0
Pod documented
77  
78 =head3 value
79  
80 Return error value.
81  
82 =cut
83  
84 2 ▶sub value { shift->{ 'value' } }
Subroutine value: called CC=1 SCAR=0.0
Pod documented
85  
86 =head3 raw
87  
88 Return RAW data from invalid response
89  
90 =cut
91  
92 0 ▶sub raw { shift->{ 'raw' } }
Subroutine raw: not called CC=1 SCAR=6.9
Pod documented
93  
94 sub _parse {
95 3 ▶ my ( $self, $response ) = @_;
Subroutine _parse: called CC=1 SCAR=0.0
96  
97 3 $self->{ 'code' } = $response->{ 'code' };
98 3 $self->{ 'message' } = $response->{ 'message' };
99 3 $self->{ 'field' } = $response->{ 'field' };
100 3 $self->{ 'value' } = $response->{ 'value' };
101 3 $self->{ 'raw' } = $response->{ 'raw' };
102  
103 3 return;
104 }
105  
106 =head1 BUGS
107  
108 Please report any bugs or feature requests to C<cynovg at cpan.org>, or through the web interface at L<https://github.com/cynovg/WG-API/issues>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
109  
110 =head1 SUPPORT
111  
112 You can find documentation for this module with the perldoc command.
113  
114 perldoc WG::API
115  
116 You can also look for information at:
117  
118 =over 4
119  
120 =item * RT: GitHub's request tracker (report bugs here)
121  
122 L<https://github.com/cynovg/WG-API/issues>
123  
124 =item * AnnoCPAN: Annotated CPAN documentation
125  
126 L<http://annocpan.org/dist/WG-API>
127  
128 =item * CPAN Ratings
129  
130 L<http://cpanratings.perl.org/d/WG-API>
131  
132 =item * Search CPAN
133  
134 L<http://search.cpan.org/dist/WG-API/>
135  
136 =back
137  
138  
139 =head1 ACKNOWLEDGEMENTS
140  
141 ...
142  
143 =head1 SEE ALSO
144  
145 WG API Reference L<http://ru.wargaming.net/developers/>
146  
147 =head1 AUTHOR
148  
149 cynovg , C<< <cynovg at cpan.org> >>
150  
151 =head1 LICENSE AND COPYRIGHT
152  
153 Copyright 2015 Cyrill Novgorodcev.
154  
155 This program is free software; you can redistribute it and/or modify it
156 under the terms of the the Artistic License (2.0). You may obtain a
157 copy of the full license at:
158  
159 L<http://www.perlfoundation.org/artistic_license_2_0>
160  
161 Any use, modification, and distribution of the Standard or Modified
162 Versions is governed by this Artistic License. By using, modifying or
163 distributing the Package, you accept this license. Do not use, modify,
164 or distribute the Package, if you do not accept this license.
165  
166 If your Modified Version has been derived from a Modified Version made
167 by someone other than you, you are nevertheless required to ensure that
168 your Modified Version complies with the requirements of this license.
169  
170 This license does not grant you the right to use any trademark, service
171 mark, tradename, or logo of the Copyright Holder.
172  
173 This license includes the non-exclusive, worldwide, free-of-charge
174 patent license to make, have made, use, offer to sell, sell, import and
175 otherwise transfer the Package with respect to any patent claims
176 licensable by the Copyright Holder that are necessarily infringed by the
177 Package. If you institute patent litigation (including a cross-claim or
178 counterclaim) against any party alleging that the Package constitutes
179 direct or contributory patent infringement, then this Artistic License
180 to you shall terminate on the date that such litigation is filed.
181  
182 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
183 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
184 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
185 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
186 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
187 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
188 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
189 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
190  
191  
192 =cut
193  
194 5 1; # End of WG::API::Error
« _build/lib/MyBuilder.pm ↑ Summary blib/lib/WG/API/WoWs.pm »