File Coverage

blib/lib/Map/Tube/Exception.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package Map::Tube::Exception;
2             $Map::Tube::Exception::AUTHORITY = 'cpan:MANWAR';
3             $Map::Tube::Exception::VERSION = '3.19';
4             =head1 NAME
5              
6             Map::Tube::Exception - Base exception package as Moo Role for Map::Tube::* family.
7              
8             =head1 VERSION
9              
10             version 3.19
11              
12             =cut
13              
14 2     2   75411 use 5.006;
  2         6  
15 2     2   588 use Data::Dumper;
  2         6668  
  2         111  
16              
17 2     2   466 use Moo::Role;
  2         16668  
  2         10  
18 2     2   1204 use namespace::autoclean;
  2         12826  
  2         11  
19             requires qw(status);
20             with 'Throwable';
21              
22 2     2   1301 use overload q{""} => 'as_string', fallback => 1;
  2         939  
  2         12  
23              
24             has method => (is => 'ro');
25             has message => (is => 'ro');
26             has filename => (is => 'ro');
27             has line_number => (is => 'ro');
28              
29             sub as_string {
30 21     21 0 4879 my ($self) = @_;
31              
32 21         212 return sprintf("%s(): %s (status: %s) file %s on line %d\n",
33             $self->method, $self->message, $self->status,
34             $self->filename, $self->line_number);
35             }
36              
37             =head1 DESCRIPTION
38              
39             Base exception package as Moo Role for Map::Tube::* family.
40              
41             Extracted out of the distribution L v3.0,so that it can be shared with
42             Map::Tube and it's Map::Tube::* family. It has been re-structured in the process.
43              
44             =head1 STATUS CODES
45              
46             +-------------+-------------------------------------------------------------+
47             | Status Code | Description |
48             +-------------+-------------------------------------------------------------+
49             | 100 | Missing station name. |
50             | 101 | Invalid station name. |
51             | 102 | Missing station id. |
52             | 103 | Invalid station id. |
53             | 104 | Missing line name. |
54             | 105 | Invalid line name. |
55             | 106 | Missing node object i.e. Map::Tube::Node. |
56             | 107 | Invalid node object. |
57             | 108 | Missing plugin graph i.e Map::Tube::Plugin::Graph. |
58             | 109 | Duplicate station name. |
59             | 110 | Duplicate station id. |
60             | 111 | Found self linked station. |
61             | 112 | Found multi linked station. |
62             | 113 | Found multi lined station. |
63             | 114 | Found unsupported map. |
64             | 115 | Missing supported map. |
65             | 116 | Found unsupported object. |
66             | 117 | Missing supported object, Map::Tube::Node / Map::Tube::Line |
67             | 118 | Invalid supported object. |
68             | 119 | Invalid line id. |
69             | 120 | Missing line id. |
70             | 121 | Missing plugin fuzzy find i.e. Map::Tube::Plugin::FuzzyFind |
71             | 122 | Missing plugin formatter i.e. Map::Tube::Plugin::Formatter |
72             | 123 | Invalid line color. |
73             | 124 | Missing Map Data. |
74             | 125 | Found unsupported map data format. |
75             | 126 | Malformed Map Data. |
76             | 127 | Invalid color hex code. |
77             | 128 | Invalid line structure. |
78             | 129 | Invalid station structure. |
79             | 130 | Invalid background color. |
80             | 131 | Invalid color name. |
81             +-------------+-------------------------------------------------------------+
82              
83             =head1 AUTHOR
84              
85             Mohammad S Anwar, C<< >>
86              
87             =head1 REPOSITORY
88              
89             L
90              
91             =head1 BUGS
92              
93             Please report any bugs or feature requests to C,
94             or through the web interface at L.
95             I will be notified, and then you'll automatically be notified of progress on your
96             bug as I make changes.
97              
98             =head1 SUPPORT
99              
100             You can find documentation for this module with the perldoc command.
101              
102             perldoc Map::Tube::Exception
103              
104             You can also look for information at:
105              
106             =over 4
107              
108             =item * RT: CPAN's request tracker (report bugs here)
109              
110             L
111              
112             =item * AnnoCPAN: Annotated CPAN documentation
113              
114             L
115              
116             =item * CPAN Ratings
117              
118             L
119              
120             =item * Search CPAN
121              
122             L
123              
124             =back
125              
126             =head1 LICENSE AND COPYRIGHT
127              
128             Copyright (C) 2015 - 2016 Mohammad S Anwar.
129              
130             This program is free software; you can redistribute it and/or modify it under
131             the terms of the the Artistic License (2.0). You may obtain a copy of the full
132             license at:
133              
134             L
135              
136             Any use, modification, and distribution of the Standard or Modified Versions is
137             governed by this Artistic License.By using, modifying or distributing the Package,
138             you accept this license. Do not use, modify, or distribute the Package, if you do
139             not accept this license.
140              
141             If your Modified Version has been derived from a Modified Version made by someone
142             other than you,you are nevertheless required to ensure that your Modified Version
143             complies with the requirements of this license.
144              
145             This license does not grant you the right to use any trademark, service mark,
146             tradename, or logo of the Copyright Holder.
147              
148             This license includes the non-exclusive, worldwide, free-of-charge patent license
149             to make, have made, use, offer to sell, sell, import and otherwise transfer the
150             Package with respect to any patent claims licensable by the Copyright Holder that
151             are necessarily infringed by the Package. If you institute patent litigation
152             (including a cross-claim or counterclaim) against any party alleging that the
153             Package constitutes direct or contributory patent infringement,then this Artistic
154             License to you shall terminate on the date that such litigation is filed.
155              
156             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
157             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
158             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
159             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
160             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
161             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
162             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
163              
164             =cut
165              
166             1; # End of Map::Tube::Exception