File Coverage

blib/lib/Algorithm/Metric/Chessboard/Wormhole.pm
Criterion Covered Total %
statement 19 19 100.0
branch 6 6 100.0
condition n/a
subroutine 5 5 100.0
pod 1 4 25.0
total 31 34 91.1


line stmt bran cond sub pod time code
1 6     6   1410 use strict;
  6         12  
  6         2010  
2             package Algorithm::Metric::Chessboard::Wormhole;
3              
4             =head1 NAME
5              
6             Algorithm::Metric::Chessboard::Wormhole - Model a wormhole for Algorithm::Metric::Chessboard.
7              
8             =head1 DESCRIPTION
9              
10             See L.
11              
12             =head1 METHODS
13              
14             =over
15              
16             =item B
17              
18             my $wormhole =
19             Algorithm::Metric::Chessboard::Wormhole->new(
20             x => 5,
21             y => 30,
22             id => "Warp Gate",
23             );
24              
25             C and C are mandatory. C is optional; it's not used
26             internally but is provided as a space for you to store any id you
27             like, in case your program is interested in which wormholes were used
28             in a journey.
29              
30             =cut
31              
32             sub new {
33 8     8 1 92 my ($class, %args) = @_;
34 8         17 my $self = {};
35 8         60 bless $self, $class;
36 8         36 $self->x( $args{x} );
37 8         654 $self->y( $args{y} );
38 8         23 $self->id( $args{id} );
39 8         33 return $self;
40             }
41              
42             sub x {
43 70012     70012 0 99395 my ($self, $value) = @_;
44 70012 100       132333 $self->{x} = $value if $value;
45 70012         180363 return $self->{x};
46             }
47              
48             sub y {
49 70012     70012 0 88835 my ($self, $value) = @_;
50 70012 100       126158 $self->{y} = $value if $value;
51 70012         251215 return $self->{y};
52             }
53              
54             sub id {
55 11     11 0 984 my ($self, $value) = @_;
56 11 100       40 $self->{id} = $value if $value;
57 11         38 return $self->{id};
58             }
59              
60              
61             =back
62              
63             =head1 AUTHOR
64              
65             Kake Pugh (kake@earth.li).
66              
67             =head1 COPYRIGHT
68              
69             Copyright (C) 2004 Kake Pugh. All Rights Reserved.
70              
71             This module is free software; you can redistribute it and/or modify it
72             under the same terms as Perl itself.
73              
74             =cut
75              
76             1;