blib/lib/Spreadsheet/WriteExcel/WebPivot.pm

filter: Statementstmt 81.6% 173 / 212 Branchbran 50.0% 24 / 48 Conditioncond 33.3% 5 / 15 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 90.4% 19 / 21 Podpod 12.5% 1 / 8 totaltotal 70.9% 222 / 313 CC 32 SCAR 18.6
CC
32
Cov
73%
cleanhash4xml
14.0
getDataTypes
9.5
makewebpivot
8.4
CRAP 6.4
↑ Summary
1 package Spreadsheet::WriteExcel::WebPivot;
2
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Switch;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use POSIX 'strftime';
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 1 our(@ISA, @EXPORT);
12 sub makewebpivot;
13
14 1 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 @EXPORT = qw(makewebpivot);
16
17 1 our $VERSION = '0.01';
18
19 #-----------------------------------------------------------------------
20 # not needed or even that useful anymore now that we are exporting the
21 # main function
22 #
23 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
24 0 my $class = shift;
25 0 ▶ $class = ref($class) if (ref($class));
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
26
27 0 my $self = {};
28 0 bless($self, $class);
29 0 return $self;
30 }
31
32
33 # these four variables are for storing large amounts of text for
34 # a home-brew template system. The Template Toolkit is much better
35 # but I wanted to reduce module dependencies
36
37 1 my ($pivotcachetext, $pivotcachefooter,$pivothdrtext,$filelisttmpl);
38
39 #-----------------------------------------------------------------------
40 # this function is an internal function that does the proper xml
41 # escaping for hash references containing
42 # data that needs to be output as xml
43
44 20 ▶sub cleanhash4xml {
Subroutine cleanhash4xml: called CC=9 SCAR=26.4
Pod undocumented
45 20 my $self = shift; # get class thingy
46 20 my $rhsh = shift;
47
48 20 ▶ return unless(defined($rhsh));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rhsh 0 20 20
49 20 my @keys = keys %$rhsh;
50 # the line below takes care of uninitialized data errors
51 20 ▶ map {(!exists($rhsh->{$_}) or !defined($rhsh->{$_})) ? $rhsh->{$_} = ' ': 1} @keys;
Branch: 1 branch
BranchTrueFalseTotal
!(exists $rhsh->{$_} && defined $rhsh->{$_}) ? : 0 40 40
Condition33%1/3
exists $rhsh->{$_} && defined $rhsh->{$_}
!ll&&!rl&&r
0040
MC/DC0%0/2
exists $rhsh->{$_} && defined $rhsh->{$_}
exists $rhsh->{$_} defined $rhsh->{$_}
Truth table33%1/3
A && B
A= exists $rhsh->{$_}B= defined $rhsh->{$_}
ABresult
0X0
100
111
52 20 map ($rhsh->{$_} =~ s/\&/\&/g, @keys);
53 20 map ($rhsh->{$_} =~ s/"/\"/g, @keys);
54 20 map ($rhsh->{$_} =~ s/</\&lt;/g, @keys);
55 20 map ($rhsh->{$_} =~ s/>/\&gt;/g, @keys);
56 20 map ($rhsh->{$_} =~ s/[^[:alnum:][:punct:] ]//g, @keys);
57 20 ▶ if (defined($self->{types})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"types"}) 20 0 20
58 20 foreach my $key (@keys) {
59 #die "dead #".$rhsh->{$key} . "#\n" if( 'Tier' eq $key and !($rhsh->{$key} =~ /\w/));
60 40 ▶ if (!defined($rhsh->{$key}) or !($rhsh->{$key} =~ /\w/)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rhsh->{$key} and $rhsh->{$key} =~ /\w/) 0 40 40
Condition33%1/3
defined $rhsh->{$key} and $rhsh->{$key} =~ /\w/
!ll&&!rl&&r
0040
MC/DC0%0/2
defined $rhsh->{$key} and $rhsh->{$key} =~ /\w/
defined $rhsh->{$key} $rhsh->{$key} =~ /\w/
Truth table33%1/3
A and B
A= defined $rhsh->{$key}B= $rhsh->{$key} =~ /\w/
ABresult
0X0
100
111
61 0 ▶ if ( $self->{types}->{$key} eq 'text' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'types'}{$key} eq 'text') { } 0 0 0
62 0 $rhsh->{$key} = 'none';
63 }
64 else {
65 0 $rhsh->{$key} = "0";
66 }
67 }
68 }
69 }
70 }
71
72
73 #-----------------------------------------------------------------------
74 0 ▶sub cleanArray4xml {
Subroutine cleanArray4xml: not called CC=2 SCAR=17.9
Pod undocumented
75 0 shift; # get class thingy
76 0 my $rarr = shift;
77 # the line below takes care of uninitialized data errors
78 0 ▶ map {defined($_) ? $_ : ''} @$rarr;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
79 0 map (s/\&/\&amp;/g, @$rarr);
80 0 map (s/"/\&quot;/g, @$rarr);
81 0 map (s/</\&lt;/g, @$rarr);
82 0 map (s/>/\&gt;/g, @$rarr);
83 0 map (s/[^[:alnum:][:punct:] ]//g, @$rarr);
84 }
85
86
87
88 #-----------------------------------------------------------------------
89 1 ▶sub getDataTypes {
Subroutine getDataTypes: called CC=7 SCAR=22.5
Pod undocumented
90 1 my $self = shift;
91 1 my $href = shift;
92 1 my $rkeys = shift;
93 1 my @keys = @$rkeys;
94 1 my $type; my $typename;
95 1 my @pivotfields;
96 1 my $i = 1;
97 1 my @dkeys = keys %$href;
98 1 my %keysh; @keysh{@keys} = @keys;
99 1 ▶ map { push @keys, $_ unless(exists $keysh{$_}) } @dkeys;
Branch: 1 branch
BranchTrueFalseTotal
unless exists $keysh{$_} 0 2 2
100 1 foreach my $key (@keys) {
101 2 ▶ die "$key not defined\n" unless(defined $href->{$key});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $href->{$key} 0 2 2
102 2 switch ($href->{$key}) {
103 2 ▶ case /^\d+$/ {
Branch: 1 branch
BranchTrueFalseTotal
if (&Switch::case(qr/^\d+$/)) 1 1 2
104 1 $type = q(type="int");
105 1 $typename = 'int';
106 0 }
107 0 ▶ case /^\d+\.\d+$/ {
Branch: 1 branch
BranchTrueFalseTotal
if (&Switch::case(qr/^\d+\.\d+$/)) 0 1 1
108 0 $type = q(type="float");
109 0 $typename = 'float';
110 0 }
111 0 ▶ case qr/^\d{4}\-\d{2}\-\d{2}/ {
Branch: 1 branch
BranchTrueFalseTotal
if (&Switch::case(qr/^\d{4}\-\d{2}\-\d{2}/)) { } 0 1 1
112 0 $type = q(type="dateTime");
113 0 $typename = 'dateTime';
114 0 }
115 else {
116 1 $type = q(maxLength="255");
117 1 $typename = 'text';
118 }
119 1 }
120 2 push @pivotfields, {FIELDNAME=>$key, COLNUM=>$i++, DATATYPE=>$type};
121 2 $self->{types}->{$key} = $typename;
122 }
123 1 return @pivotfields;
124 }
125
126 #-----------------------------------------------------------------------
127 # this function sets up the subdirectory required by Excel's web object
128 #
129 1 ▶sub makepivotdir {
Subroutine makepivotdir: called CC=4 SCAR=14.0
Pod undocumented
130 1 my $file = shift;
131 1 my $title = shift;
132 1 my $rkeys = shift;
133 1 my $summarytype = shift;
134
135 1 ▶ mkdir $file . "_files" unless( -d $file . "_files" );
Branch: 1 branch
BranchTrueFalseTotal
unless -d $file . '_files' 1 0 1
136 # if the summary flag was not set or the directory does not exist
137 # generate table main page ( as opposed to the data page )
138 # based on pivotfields
139 1 ▶ my $fh = FileHandle->new(">$file".".htm")
Branch: 1 branch
BranchTrueFalseTotal
my $fh = "FileHandle"->new(">$file" . '.htm') or die "Unable to open $file\n" 1 0 1
140 or die "Unable to open $file\n";
141
142 1 printPivotHdr($fh, $title, $file, $rkeys, $summarytype);
143
144 1 $fh->close;
145 1 ▶ $fh->open(">$file".'_files/filelist.xml') or
Branch: 1 branch
BranchTrueFalseTotal
$fh->open(">$file" . '_files/filelist.xml') or die "Unable to open $file _files/filelist.xml\n" 1 0 1
146 die "Unable to open $file _files/filelist.xml\n";
147 1 $filelisttmpl =~ s/CACHENAME/$file/g;
148 1 print $fh $filelisttmpl;
149 1 $fh->close;
150 }
151
152 #-----------------------------------------------------------------------
153 # this is an internal function that takes each successive row of data
154 # and puts it in the required format
155 #
156 20 ▶sub addPivotData {
Subroutine addPivotData: called CC=3 SCAR=11.0
Pod undocumented
157 20 my $self = shift;
158 20 my $fh = shift;
159 20 my $href = shift;
160 20 my $datarows = shift;
161 20 my $rkeys = shift;
162 20 my $i;
163
164 20 $self->cleanhash4xml($href); # takes care of escaping characters.
165 20 my @keys = @$rkeys;
166 20 my $key1 = $keys[0];
167 20 my $keyN = $keys[$#keys];
168 20 my @dkeys = keys %$href;
169 20 my %keysh; @keysh{@keys} = @keys;
170 20 ▶ map { push @keys, $_ unless(exists $keysh{$_}) } @dkeys;
Branch: 1 branch
BranchTrueFalseTotal
unless exists $keysh{$_} 0 40 40
171 #print "keys: @keys\n";
172 20 my @datacolumns;
173 20 ▶ for ($i=1; my $key = shift @keys; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $key = shift @keys) 40 20 60
174 40 push @datacolumns, qq(Col$i="$href->{$key}");
175 }
176 20 print $fh " <z:row ",join(" ",@datacolumns),"/>\n";
177 20 return $i; # return the column count
178 }
179
180
181 #-----------------------------------------------------------------------
182 # this is the top level function. The only one called directly by the
183 # user.
184 #
185 1 ▶sub makewebpivot {
Subroutine makewebpivot: called CC=8 SCAR=21.3
Pod documented
186 #my $self = shift;
187 1 my $self = bless({},'Spreadsheet::WriteExcel::WebPivot');
188 1 my $dbh = shift; my $query = shift;
189 1 my $rquerykeys = shift;
190 1 my $summarytype = shift;
191 1 my $file = shift;
192 1 my $title = shift;
193
194 # the line below allows us to pass in a reference to
195 # an array of hash refs and the code will pretend it is a
196 # DBI object and fetch each hashref in the array.
197 1 ▶ $dbh = Spreadsheet::WriteExcel::WebPivot::FakeDBI->new($dbh) if( ref($dbh) eq 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $dbh eq "ARRAY" 1 0 1
198
199 1 $self->{SummaryType} = $summarytype;
200
201 1 my @datarows; my @queries = ();
202 1 ▶ if( 'ARRAY' eq ref($query) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("ARRAY" eq ref $query) 0 1 1
203 0 @queries = @$query;
204 0 $query = shift @queries;
205 }
206 1 my $sth = $dbh->prepare($query);
207 1 $sth->execute;
208
209 1 makepivotdir($file,$title,$rquerykeys,$summarytype);
210
211 1 my $fh = FileHandle->new(">$file"."_files/$file".'_1234_cachedata001.xml');
212 1 ▶ die "Unable to open cache\n" unless($fh);
Branch: 1 branch
BranchTrueFalseTotal
unless $fh 0 1 1
213
214 1 my $href = $sth->fetchrow_hashref;
215 1 my @pivotfields = $self->getDataTypes($href,$rquerykeys);
216 {
217 1 local $/ = undef; # INPUT SEPARATOR
218 1 local $" = "\n"; # OUTPUT SEPARATOR
219 1 my @ncolumns = (map { qq( <s:attribute type="Col$_"/>) }
220 (1..scalar(@pivotfields))
221 );
222 1 my @columns;
223 1 map { push @columns,
224 qq( <s:AttributeType name="Col$_->{COLNUM}" rs:name="$_->{FIELDNAME}">),
225 qq( <s:datatype dt:$_->{DATATYPE}/>),
226 qq( </s:AttributeType>); } @pivotfields;
227 1 my $outtext = eval $pivotcachetext;
228 1 print $fh $outtext;
229 }
230 1 my $colcount = $self->addPivotData($fh,$href,\@datarows, $rquerykeys);
231
232 # a bit of code gymnastics here to handle an array of query strings
233 # if there are multiple query strings we run execute each new query
234 # and run the loop again.
235 1 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$query = shift @queries and $sth = $dbh->prepare($query) and $sth->execute and do { do { while ($href = $sth->fetchrow_hashref) { $colcount = $self->addPivotData($fh, $href, \@datarows, $rquerykeys); } ; $sth->finish } } 0 1 1
Condition33%2/6
$query = shift @queries and $sth = $dbh->prepare($query) and $sth->execute
!ll&&!rl&&r
100
$query = shift @queries and $sth = $dbh->prepare($query)
!ll&&!rl&&r
100
MC/DC0%0/3
$query = shift @queries and $sth = $dbh->prepare($query) and $sth->execute
$query = shift @queries $sth = $dbh->prepare($query) $sth->execute
Truth table25%1/4
A and B and C
A= $query = shift @queriesB= $sth = $dbh->prepare($query)C= $sth->execute
ABCresult
0XX0
10X0
1100
1111
236 1 ▶ while( $href = $sth->fetchrow_hashref ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($href = $sth->fetchrow_hashref) 19 1 20
237 19 $colcount = $self->addPivotData($fh,$href, \@datarows, $rquerykeys);
238 }
239 1 $sth->finish;
240 } while( ($query = shift @queries) && ($sth = $dbh->prepare($query)) && $sth->execute );
241
242 1 print $fh $pivotcachefooter;
243 1 $fh->close;
244
245 #$sth->finish;
246
247 } # end makewebpivot
248
249
250 #-----------------------------------------------------------------------
251 # internal variable initialization
252 #
253
254 1 $pivotcachetext = q(qq(<xml xmlns:x="urn:schemas-microsoft-com:office:excel"
255 xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
256 xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
257 xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
258 <x:PivotCache>
259 <x:CacheIndex>1</x:CacheIndex>
260 <s:Schema id="RowsetSchema">
261 <s:ElementType name="row" content="eltOnly">
262 @ncolumns
263 <s:extends type="rs:rowbase"/>
264 </s:ElementType>
265 @columns
266 </s:Schema>
267 <rs:data>
268 ));
269
270 1 $pivotcachefooter = q(
271 </rs:data>
272 </x:PivotCache>
273 </xml>
274 );
275
276 1 $filelisttmpl = q(
277 <xml xmlns:o="urn:schemas-microsoft-com:office:office">
278 <o:MainFile HRef="../CACHENAME.htm"/>
279 <o:File HRef="CACHENAME_1234_cachedata001.xml"
280 PublicationID="CACHENAME"/>
281 <o:File HRef="filelist.xml"/>
282 </xml>
283 );
284
285 # another "role your own template" function
286 # printPivotHdr creates the file that serves as the header file for Excel XML
287 # web objects
288
289 1 ▶sub printPivotHdr {
Subroutine printPivotHdr: called CC=2 SCAR=6.9
Pod undocumented
290 1 my ($fh,$TITLE,$CACHENAME,$rkeys,$SUMMARYTYPE,$NOSUBTOTAL) = @_;
291 #print "Summary Type = $SUMMARYTYPE\n";
292 1 ▶ if($NOSUBTOTAL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($NOSUBTOTAL) { } 0 1 1
293 0 $NOSUBTOTAL = q(&lt;Subtotal&gt;None&lt;/Subtotal&gt;&#13;&#10;);
294 1 } else { $NOSUBTOTAL = ''; }
295
296 1 my @pivotfields = @$rkeys;
297 1 my $DATAFIELD = $pivotfields[$#pivotfields];
298 1 my @pivotfieldsloop;
299 1 my ($POS,$FIELDNAME);
300
301 1 map { $POS++; $FIELDNAME = $_;
302 1 push @pivotfieldsloop, qq(
303 &lt;PivotField&gt;&#13;&#10;
304 &lt;Name&gt;$FIELDNAME&lt;/Name&gt;&#13;&#10;
305 &lt;Orientation&gt;Row&lt;/Orientation&gt;&#13;&#10;
306 $NOSUBTOTAL
307 &lt;Position&gt;$POS&lt;/Position&gt;&#13;&#10;
308 &lt;PivotItem&gt;&#13;&#10; &lt;Name&gt;&lt;/Name&gt;&#13;&#10;
309 &lt;Hidden/&gt;&#13;&#10; &lt;HideDetail/&gt;&#13;&#10;
310 &lt;/PivotItem&gt;&#13;&#10; &lt;/PivotField&gt;&#13;&#10;
311 ); } @pivotfields[0..$#pivotfields-1];
312
313 1 my $TODAY = strftime '%Y-%m-%d %H:%M:%S', localtime;
314 1 $TODAY =~ s/ /T/;
315 1 $pivothdrtext =~ s/CACHENAME/$CACHENAME/gm;
316 1 $pivothdrtext =~ s/TITLE/$TITLE/gm;
317 1 $pivothdrtext =~ s/TODAY/$TODAY/gm;
318 1 $pivothdrtext =~ s/DATAFIELD/$DATAFIELD/gm;
319 1 $pivothdrtext =~ s/SUMMARYTYPE/$SUMMARYTYPE/gm;
320 1 $pivothdrtext =~ s/PIVOTFIELDSLOOP/@pivotfieldsloop/m;
321 1 print $fh $pivothdrtext;
322 #print $fh "@pivotfieldsloop\n";
323 }
324
325 # I appologize in advance for the big, ugly inlined document that follows
326 # I would have prefered to store this text after the END marker and use
327 # the <DATA> handle to access it but that doesn't work in this module file.
328
329 1 $pivothdrtext = q(<html xmlns:o="urn:schemas-microsoft-com:office:office"
330 xmlns:x="urn:schemas-microsoft-com:office:excel"
331 xmlns="http://www.w3.org/TR/REC-html40">
332 <head>
333 <title>TITLE</title>
334 <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
335 <meta name=ProgId content=FrontPage.Editor.Document>
336 <meta name=Generator content="Perl instead of Excel 10">
337 <link rel=File-List href="CACHENAME_files/filelist.xml">
338 </head>
339 <body>
340 <!--[if !excel]>&nbsp;&nbsp;<![endif]-->
341 <!--The following information wasn't generated by Microsoft Excel's Publish as Web
342 Page wizard.-->
343 <!--If the same item is republished from Excel, all information between the DIV
344 tags will be replaced.-->
345 <!----------------------------->
346 <!--START OF OUTPUT FROM EXCEL PUBLISH AS WEB PAGE WIZARD -->
347 <!----------------------------->
348 <div id="CACHENAME_1234" align=left x:publishsource="Excel"><object
349 id="CACHENAME_1234_PivotTable"
350 classid="CLSID:0002E552-0000-0000-C000-000000000046">
351 <param name=XMLData value="&lt;!--[if gte mso 9]&gt;&lt;xml
352 xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot;&#13;&#10;
353 xmlns:x=&quot;urn:schemas-microsoft-com:office:excel&quot;&#13;&#10;
354 xmlns:html=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;&#13;&#10;
355 &lt;WorksheetOptions
356 xmlns=&quot;urn:schemas-microsoft-com:office:excel&quot;&gt;&#13;&#10;
357 &lt;Zoom&gt;0&lt;/Zoom&gt;&#13;&#10; &lt;Selected/&gt;&#13;&#10;
358 &lt;TopRowVisible&gt;2&lt;/TopRowVisible&gt;&#13;&#10;
359 &lt;Panes&gt;&#13;&#10; &lt;Pane&gt;&#13;&#10;
360 &lt;Number&gt;3&lt;/Number&gt;&#13;&#10;
361 &lt;RangeSelection&gt;$D:$D&lt;/RangeSelection&gt;&#13;&#10;
362 &lt;/Pane&gt;&#13;&#10; &lt;/Panes&gt;&#13;&#10;
363 &lt;ProtectContents&gt;False&lt;/ProtectContents&gt;&#13;&#10;
364 &lt;ProtectObjects&gt;False&lt;/ProtectObjects&gt;&#13;&#10;
365 &lt;ProtectScenarios&gt;False&lt;/ProtectScenarios&gt;&#13;&#10;
366 &lt;/WorksheetOptions&gt;&#13;&#10; &lt;PivotTable
367 xmlns=&quot;urn:schemas-microsoft-com:office:excel&quot;&gt;&#13;&#10;
368 &lt;PTSource&gt;&#13;&#10;
369 &lt;DataMember&gt;XLDataSource&lt;/DataMember&gt;&#13;&#10;
370 &lt;CacheIndex&gt;1&lt;/CacheIndex&gt;&#13;&#10;
371 &lt;VersionLastRefresh&gt;1&lt;/VersionLastRefresh&gt;&#13;&#10;
372 &lt;RefreshName&gt;perlpivot&lt;/RefreshName&gt;&#13;&#10;
373 &lt;CacheFile HRef=&quot;CACHENAME_files/CACHENAME_1234_cachedata001.xml&quot;/&gt;&#13;&#10;
374 &lt;RefreshDate&gt;TODAY&lt;/RefreshDate&gt;&#13;&#10;
375 &lt;RefreshDateCopy&gt;TODAY&lt;/RefreshDateCopy&gt;&#13;&#10;
376 &lt;/PTSource&gt;&#13;&#10;
377 &lt;Name&gt; TITLE &lt;/Name&gt;&#13;&#10;
378 &lt;DataMember&gt;XLDataSource&lt;/DataMember&gt;&#13;&#10;
379 &lt;ImmediateItemsOnDrop/&gt;&#13;&#10;
380 &lt;ShowPageMultipleItemLabel/&gt;&#13;&#10;
381 &lt;Location&gt;$A$1:$D$5&lt;/Location&gt;&#13;&#10;
382 &lt;VersionLastUpdate&gt;1&lt;/VersionLastUpdate&gt;&#13;&#10;
383 &lt;DefaultVersion&gt;1&lt;/DefaultVersion&gt;&#13;&#10;
384 &lt;PivotField&gt;&#13;&#10;
385 &lt;Name&gt;DATAFIELD&lt;/Name&gt;&#13;&#10;
386 &lt;/PivotField&gt;&#13;&#10;
387 PIVOTFIELDSLOOP
388 &lt;PivotField&gt;&#13;&#10; &lt;DataField/&gt;&#13;&#10;
389 &lt;Name&gt;Data&lt;/Name&gt;&#13;&#10;
390 &lt;Orientation&gt;Row&lt;/Orientation&gt;&#13;&#10;
391 &lt;Position&gt;-1&lt;/Position&gt;&#13;&#10;
392 &lt;/PivotField&gt;&#13;&#10;
393 &lt;PivotField&gt;&#13;&#10;
394 &lt;Name&gt;SUMMARYTYPE of DATAFIELD&lt;/Name&gt;&#13;&#10;
395 &lt;ParentField&gt;DATAFIELD&lt;/ParentField&gt;&#13;&#10;
396 &lt;NumberFormat&gt;#,##0&lt;/NumberFormat&gt;&#13;&#10;
397 &lt;Orientation&gt;Data&lt;/Orientation&gt;&#13;&#10;
398 &lt;Function&gt;SUMMARYTYPE&lt;/Function&gt;&#13;&#10;
399 &lt;Position&gt;1&lt;/Position&gt;&#13;&#10;
400 &lt;/PivotField&gt;&#13;&#10; &lt;PTFormat
401 Style='mso-number-format:&quot;\#\,\#\#0&quot;'&gt;&#13;&#10;
402 &lt;PTRule&gt;&#13;&#10;
403 &lt;RuleType&gt;DataOnly&lt;/RuleType&gt;&#13;&#10;
404 &lt;/PTRule&gt;&#13;&#10; &lt;/PTFormat&gt;&#13;&#10; &lt;PTFormat
405 Style='mso-number-format:&quot;\#\,\#\#0&quot;'&gt;&#13;&#10;
406 &lt;PTRule&gt;&#13;&#10;
407 &lt;RuleType&gt;Blanks&lt;/RuleType&gt;&#13;&#10;
408 &lt;/PTRule&gt;&#13;&#10; &lt;/PTFormat&gt;&#13;&#10;
409 &lt;/PivotTable&gt;&#13;&#10;&lt;/xml&gt;&lt;![endif]--&gt;"><p
410 style='margin-top:100;font-family:Arial;font-size:8.0pt'>To use this Web
411 page interactively, you must have Microsoft Internet Explorer 4.01 Service
412 Pack 1 (SP1) or later and the Microsoft Office XP Web Components.</p>
413 <p style='margin-top:100;font-family:Arial;font-size:8.0pt'>See the <a
414 href="http://office.microsoft.com/office/redirect/10/MSOWCPub.asp?HelpLCID=1033">Microsoft
415 Office Web site</a> for more information.</p>
416 </object></div>
417 <!----------------------------->
418 <!--END OF OUTPUT FROM EXCEL PUBLISH AS WEB PAGE WIZARD-->
419 <!----------------------------->
420 <br>
421 </body>
422 </html>
423 );
424
425 package Spreadsheet::WriteExcel::WebPivot::FakeDBI;
426
427 # the constructor
428 1 ▶sub new {
Subroutine new: called CC=3 SCAR=13.0
429 1 my $class = shift;
430 1 my $arg = shift;
431 1 ▶ if( defined($arg) and ref($arg) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg and ref $arg eq 'ARRAY') { } 1 0 1
Condition33%1/3
defined $arg and ref $arg eq "ARRAY"
!ll&&!rl&&r
001
MC/DC0%0/2
defined $arg and ref $arg eq "ARRAY"
defined $arg ref $arg eq "ARRAY"
Truth table33%1/3
A and B
A= defined $argB= ref $arg eq "ARRAY"
ABresult
0X0
100
111
432 1 bless($arg); # I don't expect anyone to ever inherit from this
433 } else {
434 0 $arg = [];
435 0 bless($arg);
436 }
437 1 return $arg;
438 }
439
440 1 ▶sub prepare {
Subroutine prepare: called CC=1 SCAR=0.0
441 1 my $self = shift;
442 1 return $self;
443 }
444
445 1 ▶sub execute {
Subroutine execute: called CC=1 SCAR=0.0
446 }
447
448 1 ▶sub finish {
Subroutine finish: called CC=1 SCAR=0.0
449 }
450
451 21 ▶sub fetchrow_hashref {
Subroutine fetchrow_hashref: called CC=1 SCAR=0.0
452 21 my $self = shift;
453 21 return shift @$self;
454 }
455
456 # Autoload methods go after =cut, and are processed by the autosplit program.
457
458 1 1;
459
460 __END__
↑ Summary