File Coverage

blib/lib/Grid/Layout/Cell.pm
Criterion Covered Total %
statement 29 29 100.0
branch 3 6 50.0
condition n/a
subroutine 7 7 100.0
pod 0 3 0.0
total 39 45 86.6


line stmt bran cond sub pod time code
1             #_{ Encoding and name
2             =encoding utf8
3             =head1 NAME
4             Grid::Layout::Cell
5             =cut
6             #_}
7             package Grid::Layout::Cell;
8             #_{ use …
9 2     2   10 use warnings;
  2         4  
  2         52  
10 2     2   9 use strict;
  2         3  
  2         29  
11 2     2   7 use utf8;
  2         3  
  2         7  
12              
13 2     2   40 use Carp;
  2         3  
  2         505  
14             #_}
15             our $VERSION = 0.01;
16             #_{ Synopsis
17              
18             =head1 SYNOPSIS
19             =cut
20             #_}
21             #_{ Description
22              
23             =head1 DESCRIPTION
24              
25             A C<< Grid::Layout::Cell >> is the intersection of two orthogonal
26             L<< Grid::Layout::Track >>s.
27              
28             It is the smallest unit with size in a grid.
29              
30             Although the I for all cells is equal, the I of rendered cell can vary.
31              
32             =cut
33             #_}
34             #_{ Methods
35             #_{ POD
36             =head1 METHODS
37             =cut
38             #_}
39             sub new { #_{
40             #_{ POD
41             =head2 new
42              
43             =cut
44             #_}
45              
46              
47 80     80 0 99 my $class = shift;
48              
49 80         93 my $grid_layout = shift;
50 80         89 my $x = shift;
51 80         91 my $y = shift;
52              
53 80 50       179 croak 'Grid::Layout expected' unless $grid_layout->isa('Grid::Layout' );
54 80 50       219 croak 'Number expected' unless $x =~ /^\d+/;
55 80 50       163 croak 'Number expected' unless $y =~ /^\d+/;
56              
57 80         121 my $self = {};
58              
59 80         144 $self->{grid_layout} = $grid_layout;
60 80         123 $self->{x } = $x;
61 80         160 $self->{y } = $y;
62              
63 80         113 bless $self, $class;
64 80         251 return $self;
65              
66             } #_}
67             #_{ x/y
68             sub x { #_{
69 103     103 0 30704 my $self = shift;
70 103         287 return $self->{x};
71             } #_}
72             sub y { #_{
73 90     90 0 135 my $self = shift;
74 90         183 return $self->{y};
75             } #_}
76             #_}
77             #_}
78             #_{ POD: Copyright
79              
80             =head1 Copyright
81             Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved.
82             This program is free software; you can redistribute it and/or modify it
83             under the terms of the the Artistic License (2.0). You may obtain a
84             copy of the full license at: L
85             =cut
86              
87             #_}
88              
89             'tq84';