File Coverage

blib/lib/Data/Grid/Cell.pm
Criterion Covered Total %
statement 18 21 85.7
branch n/a
condition n/a
subroutine 6 9 66.6
pod 3 3 100.0
total 27 33 81.8


line stmt bran cond sub pod time code
1             package Data::Grid::Cell;
2              
3 1     1   6 use warnings FATAL => 'all';
  1         2  
  1         28  
4 1     1   4 use strict;
  1         1  
  1         16  
5              
6 1     1   4 use base 'Data::Grid::Container';
  1         1  
  1         60  
7              
8 1     1   5 use overload '0+' => 'value';
  1         2  
  1         3  
9 1     1   55 use overload '""' => 'value';
  1         1  
  1         3  
10 1     1   42 use overload 'bool' => 'value';
  1         1  
  1         3  
11              
12             =head1 NAME
13              
14             Data::Grid::Cell - Cell implementation for Data::Grid::Row
15              
16             =head1 VERSION
17              
18             Version 0.01_01
19              
20             =cut
21              
22             our $VERSION = '0.01_01';
23              
24              
25             =head1 SYNOPSIS
26              
27             for my $cell (@$cells) {
28             warn $cell->value;
29              
30             # string overload
31             printf "%s\n", $cell;
32             }
33              
34             =head1 METHODS
35              
36             =head2 value
37              
38             Retrieves a representation of the value of the cell, potentially
39             formatted by the source, versus a possible alternate L
40             value. This method is a I, and should be defined in a driver
41             subclass. If the cell is stringified, compared numerically or tested
42             for truth, this is the method that is called, like so:
43              
44             print "$cell\n"; # stringification overloaded
45              
46             =cut
47              
48             sub value {
49 0     0 1   Carp::croak("Somebody forgot to override this method.");
50             }
51              
52             =head2 literal
53              
54             Spreadsheets tend to have a literal value underlying a formatted value
55             in a cell, which is why we have this class and are not just using
56             scalars to represent cells. If your driver has literal values,
57             override this method, otherwise it is a no-op.
58              
59             =cut
60              
61             sub literal {
62 0     0 1   $_[0]->value;
63             }
64              
65             =head2 row
66              
67             Alias for L.
68              
69             =cut
70              
71             sub row {
72 0     0 1   $_[0]->parent;
73             }
74              
75             =head1 AUTHOR
76              
77             Dorian Taylor, C<< >>
78              
79             =head1 BUGS
80              
81             Please report any bugs or feature requests to C, or through
82             the web interface at L. I will be notified, and then you'll
83             automatically be notified of progress on your bug as I make changes.
84              
85              
86              
87              
88             =head1 SUPPORT
89              
90             You can find documentation for this module with the perldoc command.
91              
92             perldoc Data::Grid::Cell
93              
94              
95             You can also look for information at:
96              
97             =over 4
98              
99             =item * RT: CPAN's request tracker
100              
101             L
102              
103             =item * AnnoCPAN: Annotated CPAN documentation
104              
105             L
106              
107             =item * CPAN Ratings
108              
109             L
110              
111             =item * Search CPAN
112              
113             L
114              
115             =back
116              
117             =head1 SEE ALSO
118              
119             L, L, L,
120             L
121              
122             =head1 LICENSE AND COPYRIGHT
123              
124             Copyright 2010 Dorian Taylor.
125              
126             This program is free software; you can redistribute it and/or modify it
127             under the terms of either: the GNU General Public License as published
128             by the Free Software Foundation; or the Artistic License.
129              
130             See http://dev.perl.org/licenses/ for more information.
131              
132              
133             =cut
134              
135             1; # End of Data::Grid::Cell