line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Grid::Excel; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
763
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
8
|
use base 'Data::Grid'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
374
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
674
|
use Spreadsheet::ParseExcel; |
|
1
|
|
|
|
|
43064
|
|
|
1
|
|
|
|
|
24
|
|
9
|
1
|
|
|
1
|
|
6
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
177
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Data::Grid::Excel - Excel driver for Data::Grid |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.01_01 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.01_01'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
31
|
0
|
|
|
|
|
|
my %p = @_; |
32
|
0
|
|
|
|
|
|
$p{driver} = Spreadsheet::ParseExcel->new; |
33
|
0
|
0
|
|
|
|
|
$p{proxy} = $p{driver}->parse($p{fh}) or Carp::croak($p{driver}->error); |
34
|
0
|
|
|
|
|
|
bless \%p, $class; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 tables |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub tables { |
42
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
43
|
0
|
|
|
|
|
|
my $counter = 0; |
44
|
0
|
|
|
|
|
|
my @tables; |
45
|
0
|
|
|
|
|
|
for my $sheet ($self->{proxy}->worksheets) { |
46
|
0
|
|
|
|
|
|
push @tables, $self->table_class->new($self, $counter++, $sheet); |
47
|
|
|
|
|
|
|
} |
48
|
0
|
0
|
|
|
|
|
wantarray ? @tables : \@tables; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 table_class |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub table_class { |
56
|
0
|
|
|
0
|
1
|
|
'Data::Grid::Excel::Table'; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 row_class |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub row_class { |
64
|
0
|
|
|
0
|
1
|
|
'Data::Grid::Excel::Row'; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 cell_class |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub cell_class { |
72
|
0
|
|
|
0
|
1
|
|
'Data::Grid::Excel::Cell'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
package Data::Grid::Excel::Table; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
1
|
|
6
|
use base 'Data::Grid::Table'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
357
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub rewind { |
80
|
0
|
|
|
0
|
|
|
$_[0]->{counter} = 0; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub next { |
84
|
0
|
|
|
0
|
|
|
my $self = shift; |
85
|
0
|
|
0
|
|
|
|
$self->{counter} ||= 0; |
86
|
0
|
|
|
|
|
|
my ($minr, $maxr) = $self->proxy->row_range; |
87
|
|
|
|
|
|
|
#my ($minc, $maxc) = $self->proxy->col_range; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
0
|
|
|
|
if ($maxr - $minr > 0 and $self->{counter} + $minr <= $maxr) { |
90
|
|
|
|
|
|
|
#warn "yooo"; |
91
|
|
|
|
|
|
|
#warn $self->parent->row_class; |
92
|
|
|
|
|
|
|
return $self->parent->row_class->new |
93
|
0
|
|
|
|
|
|
($self, $self->{counter}, $minr + $self->{counter}++); |
94
|
|
|
|
|
|
|
} |
95
|
0
|
|
|
|
|
|
return; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
package Data::Grid::Excel::Row; |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
1
|
|
6
|
use base 'Data::Grid::Row'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
326
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub cells { |
103
|
0
|
|
|
0
|
|
|
my $self = shift; |
104
|
0
|
|
|
|
|
|
my ($minc, $maxc) = $self->parent->proxy->col_range; |
105
|
|
|
|
|
|
|
#warn "$minc $maxc"; |
106
|
0
|
|
|
|
|
|
my @cells; |
107
|
|
|
|
|
|
|
#warn $self->parent->parent->cell_class; |
108
|
0
|
|
|
|
|
|
for (my $c = 0; $c <= $maxc - $minc; $c++) { |
109
|
0
|
|
|
|
|
|
push @cells, $self->parent->parent->cell_class->new |
110
|
|
|
|
|
|
|
($self, $c, $self->parent->proxy->get_cell($self->proxy, $c)); |
111
|
|
|
|
|
|
|
} |
112
|
0
|
0
|
|
|
|
|
wantarray ? @cells : \@cells; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
package Data::Grid::Excel::Cell; |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
1
|
|
6
|
use base 'Data::Grid::Cell'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
330
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub value { |
120
|
0
|
0
|
|
0
|
|
|
$_[0]->proxy->value if defined $_[0]->proxy; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub literal { |
124
|
0
|
0
|
|
0
|
|
|
$_[0]->proxy->unformatted if defined $_[0]->proxy; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Dorian Taylor, C<< >> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 BUGS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
134
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
135
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 SUPPORT |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
perldoc Data::Grid::Excel |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
You can also look for information at: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over 4 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
L |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * CPAN Ratings |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * Search CPAN |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=back |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Copyright 2010 Dorian Taylor. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
175
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
176
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1; # End of Data::Grid::Excel |