File Coverage

blib/lib/Data/Grid/Container.pm
Criterion Covered Total %
statement 15 23 65.2
branch 0 2 0.0
condition n/a
subroutine 5 10 50.0
pod 5 5 100.0
total 25 40 62.5


line stmt bran cond sub pod time code
1             package Data::Grid::Container;
2              
3 1     1   6 use warnings FATAL => 'all';
  1         2  
  1         29  
4 1     1   3 use strict;
  1         2  
  1         14  
5              
6 1     1   3 use Scalar::Util ();
  1         2  
  1         9  
7 1     1   3 use Carp ();
  1         2  
  1         35  
8              
9 1     1   5 use overload '""' => \&as_string;
  1         2  
  1         6  
10              
11             =head1 NAME
12              
13             Data::Grid::Container - Generic superclass for Data::Grid containers
14              
15             =head1 VERSION
16              
17             Version 0.01_01
18              
19             =cut
20              
21             our $VERSION = '0.01_01';
22              
23              
24             =head1 SYNOPSIS
25              
26             package Data::Grid::Foo;
27              
28             use base 'Data::Grid::Container';
29              
30             # Now code some specific stuff...
31              
32             =head1 DESCRIPTION
33              
34             The data grid in L is modeled as an ordered tree of
35             tables, rows and cells, all contained inside a bundle. This module
36             encapsulates the common behaviour of these components.
37              
38             =head1 METHODS
39              
40             =head2 new $parent, $position [, $proxy ]
41              
42             This basic constructor takes three arguments: the parent object, a
43             numeric position amongst its siblings, beginning with 0, and an
44             optional proxy object to manipulate directly, if it is necessary or
45             advantageous to do so.
46              
47             =cut
48              
49             sub new {
50 0     0 1   my ($class, $parent, $position, $proxy) = @_;
51 0           my %p = (
52             parent => $parent,
53             position => $position,
54             proxy => $proxy,
55             );
56              
57             # this will deep-recurse due to overloading (and `no overload`
58             # doesn't work) unless done exactly like this
59 0 0         Scalar::Util::weaken($p{parent}) unless Scalar::Util::isweak($p{parent});
60              
61 0           bless \%p, $class;
62             }
63              
64             =head2 parent
65              
66             Retrieve the parent object.
67              
68             =cut
69              
70             sub parent {
71 0     0 1   $_[0]{parent};
72             }
73              
74             =head2 position
75              
76             Retrieve the absolute position of the object, as it was passed in from
77             the constructor.
78              
79             =cut
80              
81             sub position {
82 0     0 1   $_[0]{position};
83             }
84              
85             =head2 proxy
86              
87             Retrieve the proxy object (for internal manipulation).
88              
89             =cut
90              
91             sub proxy {
92 0     0 1   $_[0]{proxy};
93             }
94              
95             =head2 as_string
96              
97             This is a I to hook up a serialization method to the string
98             overload. Fill it in at your leisure, otherwise it is a no-op.
99              
100             =cut
101              
102             sub as_string {
103 0     0 1   $_[0];
104             }
105              
106             =head1 AUTHOR
107              
108             Dorian Taylor, C<< >>
109              
110             =head1 BUGS
111              
112             Please report any bugs or feature requests to C, or through
113             the web interface at L. I will be notified, and then you'll
114             automatically be notified of progress on your bug as I make changes.
115              
116              
117              
118              
119             =head1 SUPPORT
120              
121             You can find documentation for this module with the perldoc command.
122              
123             perldoc Data::Grid::Container
124              
125              
126             You can also look for information at:
127              
128             =over 4
129              
130             =item * RT: CPAN's request tracker
131              
132             L
133              
134             =item * AnnoCPAN: Annotated CPAN documentation
135              
136             L
137              
138             =item * CPAN Ratings
139              
140             L
141              
142             =item * Search CPAN
143              
144             L
145              
146             =back
147              
148             =head1 SEE ALSO
149              
150             L, L, L,
151             L
152              
153             =head1 LICENSE AND COPYRIGHT
154              
155             Copyright 2010 Dorian Taylor.
156              
157             This program is free software; you can redistribute it and/or modify it
158             under the terms of either: the GNU General Public License as published
159             by the Free Software Foundation; or the Artistic License.
160              
161             See http://dev.perl.org/licenses/ for more information.
162              
163              
164             =cut
165              
166             1; # End of Data::Grid::Row