| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition33%1/3
exists $rhsh->{$_} && defined $rhsh->{$_}
MC/DC0%0/2
exists $rhsh->{$_} && defined $rhsh->{$_}
exists $rhsh->{$_}
defined $rhsh->{$_}
Truth table33%1/3
A && B
A= exists $rhsh->{$_}B= defined $rhsh->{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 20 | map ($rhsh->{$_} =~ s/\&/\&/g, @keys); | |||||||||||||||||||||||||||||||||||||||||
| 53 | 20 | map ($rhsh->{$_} =~ s/"/\"/g, @keys); | |||||||||||||||||||||||||||||||||||||||||
| 54 | 20 | map ($rhsh->{$_} =~ s/</\</g, @keys); | |||||||||||||||||||||||||||||||||||||||||
| 55 | 20 | map ($rhsh->{$_} =~ s/>/\>/g, @keys); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 20 | map ($rhsh->{$_} =~ s/[^[:alnum:][:punct:] ]//g, @keys); | |||||||||||||||||||||||||||||||||||||||||
| 57 | 20 | ▶ | if (defined($self->{types})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition33%1/3
defined $rhsh->{$key} and $rhsh->{$key} =~ /\w/
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/
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( $self->{types}->{$key} eq 'text' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | map (s/\&/\&/g, @$rarr); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | map (s/"/\"/g, @$rarr); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | map (s/</\</g, @$rarr); | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | map (s/>/\>/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
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | ▶ | die "$key not defined\n" unless(defined $href->{$key}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | switch ($href->{$key}) { | |||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | case /^\d+$/ { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | $type = q(type="int"); | |||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | $typename = 'int'; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | case /^\d+\.\d+$/ { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | #print "keys: @keys\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 20 | my @datacolumns; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 20 | ▶ | for ($i=1; my $key = shift @keys; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | $self->{SummaryType} = $summarytype; | |||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | my @datarows; my @queries = (); | |||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | ▶ | if( 'ARRAY' eq ref($query) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition33%2/6
$query = shift @queries and $sth = $dbh->prepare($query) and $sth->execute
$query = shift @queries and $sth = $dbh->prepare($query)
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
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | ▶ | while( $href = $sth->fetchrow_hashref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $NOSUBTOTAL = q(<Subtotal>None</Subtotal> ); | |||||||||||||||||||||||||||||||||||||||||
| 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 | <PivotField> | ||||||||||||||||||||||||||||||||||||||||||
| 304 | <Name>$FIELDNAME</Name> | ||||||||||||||||||||||||||||||||||||||||||
| 305 | <Orientation>Row</Orientation> | ||||||||||||||||||||||||||||||||||||||||||
| 306 | $NOSUBTOTAL | ||||||||||||||||||||||||||||||||||||||||||
| 307 | <Position>$POS</Position> | ||||||||||||||||||||||||||||||||||||||||||
| 308 | <PivotItem> <Name></Name> | ||||||||||||||||||||||||||||||||||||||||||
| 309 | <Hidden/> <HideDetail/> | ||||||||||||||||||||||||||||||||||||||||||
| 310 | </PivotItem> </PivotField> | ||||||||||||||||||||||||||||||||||||||||||
| 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]> <![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="<!--[if gte mso 9]><xml | ||||||||||||||||||||||||||||||||||||||||||
| 352 | xmlns:o="urn:schemas-microsoft-com:office:office" | ||||||||||||||||||||||||||||||||||||||||||
| 353 | xmlns:x="urn:schemas-microsoft-com:office:excel" | ||||||||||||||||||||||||||||||||||||||||||
| 354 | xmlns:html="http://www.w3.org/TR/REC-html40"> | ||||||||||||||||||||||||||||||||||||||||||
| 355 | <WorksheetOptions | ||||||||||||||||||||||||||||||||||||||||||
| 356 | xmlns="urn:schemas-microsoft-com:office:excel"> | ||||||||||||||||||||||||||||||||||||||||||
| 357 | <Zoom>0</Zoom> <Selected/> | ||||||||||||||||||||||||||||||||||||||||||
| 358 | <TopRowVisible>2</TopRowVisible> | ||||||||||||||||||||||||||||||||||||||||||
| 359 | <Panes> <Pane> | ||||||||||||||||||||||||||||||||||||||||||
| 360 | <Number>3</Number> | ||||||||||||||||||||||||||||||||||||||||||
| 361 | <RangeSelection>$D:$D</RangeSelection> | ||||||||||||||||||||||||||||||||||||||||||
| 362 | </Pane> </Panes> | ||||||||||||||||||||||||||||||||||||||||||
| 363 | <ProtectContents>False</ProtectContents> | ||||||||||||||||||||||||||||||||||||||||||
| 364 | <ProtectObjects>False</ProtectObjects> | ||||||||||||||||||||||||||||||||||||||||||
| 365 | <ProtectScenarios>False</ProtectScenarios> | ||||||||||||||||||||||||||||||||||||||||||
| 366 | </WorksheetOptions> <PivotTable | ||||||||||||||||||||||||||||||||||||||||||
| 367 | xmlns="urn:schemas-microsoft-com:office:excel"> | ||||||||||||||||||||||||||||||||||||||||||
| 368 | <PTSource> | ||||||||||||||||||||||||||||||||||||||||||
| 369 | <DataMember>XLDataSource</DataMember> | ||||||||||||||||||||||||||||||||||||||||||
| 370 | <CacheIndex>1</CacheIndex> | ||||||||||||||||||||||||||||||||||||||||||
| 371 | <VersionLastRefresh>1</VersionLastRefresh> | ||||||||||||||||||||||||||||||||||||||||||
| 372 | <RefreshName>perlpivot</RefreshName> | ||||||||||||||||||||||||||||||||||||||||||
| 373 | <CacheFile HRef="CACHENAME_files/CACHENAME_1234_cachedata001.xml"/> | ||||||||||||||||||||||||||||||||||||||||||
| 374 | <RefreshDate>TODAY</RefreshDate> | ||||||||||||||||||||||||||||||||||||||||||
| 375 | <RefreshDateCopy>TODAY</RefreshDateCopy> | ||||||||||||||||||||||||||||||||||||||||||
| 376 | </PTSource> | ||||||||||||||||||||||||||||||||||||||||||
| 377 | <Name> TITLE </Name> | ||||||||||||||||||||||||||||||||||||||||||
| 378 | <DataMember>XLDataSource</DataMember> | ||||||||||||||||||||||||||||||||||||||||||
| 379 | <ImmediateItemsOnDrop/> | ||||||||||||||||||||||||||||||||||||||||||
| 380 | <ShowPageMultipleItemLabel/> | ||||||||||||||||||||||||||||||||||||||||||
| 381 | <Location>$A$1:$D$5</Location> | ||||||||||||||||||||||||||||||||||||||||||
| 382 | <VersionLastUpdate>1</VersionLastUpdate> | ||||||||||||||||||||||||||||||||||||||||||
| 383 | <DefaultVersion>1</DefaultVersion> | ||||||||||||||||||||||||||||||||||||||||||
| 384 | <PivotField> | ||||||||||||||||||||||||||||||||||||||||||
| 385 | <Name>DATAFIELD</Name> | ||||||||||||||||||||||||||||||||||||||||||
| 386 | </PivotField> | ||||||||||||||||||||||||||||||||||||||||||
| 387 | PIVOTFIELDSLOOP | ||||||||||||||||||||||||||||||||||||||||||
| 388 | <PivotField> <DataField/> | ||||||||||||||||||||||||||||||||||||||||||
| 389 | <Name>Data</Name> | ||||||||||||||||||||||||||||||||||||||||||
| 390 | <Orientation>Row</Orientation> | ||||||||||||||||||||||||||||||||||||||||||
| 391 | <Position>-1</Position> | ||||||||||||||||||||||||||||||||||||||||||
| 392 | </PivotField> | ||||||||||||||||||||||||||||||||||||||||||
| 393 | <PivotField> | ||||||||||||||||||||||||||||||||||||||||||
| 394 | <Name>SUMMARYTYPE of DATAFIELD</Name> | ||||||||||||||||||||||||||||||||||||||||||
| 395 | <ParentField>DATAFIELD</ParentField> | ||||||||||||||||||||||||||||||||||||||||||
| 396 | <NumberFormat>#,##0</NumberFormat> | ||||||||||||||||||||||||||||||||||||||||||
| 397 | <Orientation>Data</Orientation> | ||||||||||||||||||||||||||||||||||||||||||
| 398 | <Function>SUMMARYTYPE</Function> | ||||||||||||||||||||||||||||||||||||||||||
| 399 | <Position>1</Position> | ||||||||||||||||||||||||||||||||||||||||||
| 400 | </PivotField> <PTFormat | ||||||||||||||||||||||||||||||||||||||||||
| 401 | Style='mso-number-format:"\#\,\#\#0"'> | ||||||||||||||||||||||||||||||||||||||||||
| 402 | <PTRule> | ||||||||||||||||||||||||||||||||||||||||||
| 403 | <RuleType>DataOnly</RuleType> | ||||||||||||||||||||||||||||||||||||||||||
| 404 | </PTRule> </PTFormat> <PTFormat | ||||||||||||||||||||||||||||||||||||||||||
| 405 | Style='mso-number-format:"\#\,\#\#0"'> | ||||||||||||||||||||||||||||||||||||||||||
| 406 | <PTRule> | ||||||||||||||||||||||||||||||||||||||||||
| 407 | <RuleType>Blanks</RuleType> | ||||||||||||||||||||||||||||||||||||||||||
| 408 | </PTRule> </PTFormat> | ||||||||||||||||||||||||||||||||||||||||||
| 409 | </PivotTable> </xml><![endif]-->"><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
Condition33%1/3
defined $arg and ref $arg eq "ARRAY"
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"
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||