File Coverage

blib/lib/Map/Tube/Node.pm
Criterion Covered Total %
statement 17 21 80.9
branch n/a
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 23 29 79.3


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