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