| 1 | package DBIx::XHTML_Table; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | our $VERSION = '1.48'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use DBI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # GLOBALS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use vars qw(%ESCAPES $T $N); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ($T,$N) = ("\t","\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | %ESCAPES = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | '&' => '&', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | '<' => '<', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | '>' => '>', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | '"' => '"', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | #################### CONSTRUCTOR ################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # see POD for documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=26.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | my $self = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | null_value => ' ', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # last arg might be GTCH (global table config hash) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | $self->{'global'} = pop if ref $_[$#_] eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # note: disconnected handles aren't caught :( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | if (UNIVERSAL::isa($_[0],'DBI::db')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # use supplied db handle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $self->{'dbh'} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $self->{'keep_alive'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | elsif (ref($_[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # go ahead and accept a pre-built 2d array ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | $self->_do_black_magic(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # create my own db handle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | eval { $self->{'dbh'} = DBI->connect(@_) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | carp $@ and return undef if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$@ && (carp($@) && (return undef))
carp($@) and return undef
MC/DC0%0/2
$@ && (carp($@) && (return undef))
$@
carp($@)
Truth table0%0/3
A && B
A= $@B= carp($@)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | #################### OBJECT METHODS ################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | sub exec_query { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my ($self,$sql,$vars) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exec_query: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | carp "can't call exec_query(): do database handle" unless $self->{'dbh'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | $self->{'sth'} = (UNIVERSAL::isa($sql,'DBI::st')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ? $sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | : $self->{'dbh'}->prepare($sql) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->{'sth'}->execute(@$vars); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | carp $@ and return undef if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$@ && (carp($@) && (return undef))
carp($@) and return undef
MC/DC0%0/2
$@ && (carp($@) && (return undef))
$@
carp($@)
Truth table0%0/3
A && B
A= $@B= carp($@)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # store the results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $self->{'fields_arry'} = [ @{$self->{'sth'}->{'NAME'}} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->{'fields_hash'} = $self->_reset_fields_hash(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->{'rows'} = $self->{'sth'}->fetchall_arrayref(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | carp "can't call exec_query(): no data was returned from query" unless @{$self->{'rows'}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if (exists $self->{'pk'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # remove the primary key info from the arry and hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $self->{'pk_index'} = delete $self->{'fields_hash'}->{$self->{'pk'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | splice(@{$self->{'fields_arry'}},$self->{'pk_index'},1) if defined $self->{'pk_index'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | sub output { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | my ($self,$config,$no_ws) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=9 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 7 | ▶ | carp "can't call output(): no data" and return '' unless $self->{'rows'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$self->{'rows'} || carp(q[can't call output(): no data]) && (return '')
carp("can't call output(): no data") and return ""
MC/DC0%0/2
$self->{'rows'} || carp(q[can't call output(): no data]) && (return '')
$self->{'rows'}
carp("can't call output(): no data")
Truth table33%1/3
A || B
A= $self->{'rows'}B= carp("can't call output(): no data")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # have to deprecate old arguments ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 7 | ▶ | if ($no_ws) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | carp "scalar arguments to output() are deprecated, use hash reference"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $N = $T = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | ▶ | if ($config and not ref $config) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$config and not ref $config
MC/DC0%0/2
$config and not ref $config
$config
not ref $config
Truth table33%1/3
A and not(B)
A= $configB= not ref $config
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | carp "scalar arguments to output() are deprecated, use hash reference"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $self->{'no_head'} = $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | elsif ($config) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 7 | $self->{'no_head'} = $config->{'no_head'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 7 | $self->{'no_ucfirst'} = $config->{'no_ucfirst'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 7 | ▶ | $N = $T = '' if $config->{'no_indent'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 7 | ▶ | if ($config->{'no_whitespace'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | carp "no_whitespace attrib deprecated, use no_indent"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $N = $T = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 7 | return $self->_build_table(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | sub modify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | ▶ | my ($self,$tag,$attribs,$cols) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modify: called CC=7 SCAR=25.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | $tag = lc $tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # apply attributes to specified columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | if (ref $attribs eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | ▶ | $cols = 'global' unless defined( $cols) && length( $cols ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $cols and length $cols
MC/DC0%0/2
defined $cols and length $cols
defined $cols
length $cols
Truth table33%1/3
A and B
A= defined $colsB= length $cols
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | $cols = $self->_refinate($cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | ▶ | while (my($attr,$val) = each %$attribs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | $self->{lc $_}->{$tag}->{$attr} = $val for @$cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # or handle a special case (e.g. <caption>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # cols is really attribs now, attribs is just a scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $self->{'global'}->{$tag} = $attribs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # there is only one caption - no need to rotate attribs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if (ref $cols->{'style'} eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $cols->{'style'} = join('; ',map { "$_: ".$cols->{'style'}->{$_} } sort keys %{$cols->{'style'}}) . ';'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $self->{'global'}->{$tag."_attribs"} = $cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | sub map_cell { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my ($self,$sub,$cols) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_cell: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | carp "map_cell() is being ignored - no data" and return $self unless $self->{'rows'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$self->{'rows'} || carp('map_cell() is being ignored - no data') && (return $self)
carp("map_cell() is being ignored - no data") and return $self
MC/DC0%0/2
$self->{'rows'} || carp('map_cell() is being ignored - no data') && (return $self)
$self->{'rows'}
carp("map_cell() is being ignored - no data")
Truth table0%0/3
A || B
A= $self->{'rows'}B= carp("map_cell() is being ignored - no data")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $cols = $self->_refinate($cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | for (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if (defined $self->{'fields_hash'}->{$_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $key = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } elsif( defined $self->{'fields_hash'}->{lc $_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $key = lc $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | SEARCH: for my $k (sort keys %{ $self->{'fields_hash'} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (lc( $k ) eq lc( $_ )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $key = $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | last SEARCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | next unless $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $self->{'map_cell'}->{$key} = $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | sub map_head { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | ▶ | my ($self,$sub,$cols) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_head: called CC=9 SCAR=31.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | ▶ | carp "map_head() is being ignored - no data" and return $self unless $self->{'rows'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$self->{'rows'} || carp('map_head() is being ignored - no data') && (return $self)
carp("map_head() is being ignored - no data") and return $self
MC/DC0%0/2
$self->{'rows'} || carp('map_head() is being ignored - no data') && (return $self)
$self->{'rows'}
carp("map_head() is being ignored - no data")
Truth table33%1/3
A || B
A= $self->{'rows'}B= carp("map_head() is being ignored - no data")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | $cols = $self->_refinate($cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | for (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | my $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | if (defined $self->{'fields_hash'}->{$_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | $key = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } elsif( defined $self->{'fields_hash'}->{lc $_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $key = lc $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | SEARCH: for my $k (sort keys %{ $self->{'fields_hash'} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if (lc( $k ) eq lc( $_ )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $key = $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | last SEARCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | ▶ | next unless $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | $self->{'map_head'}->{$key} = $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | sub add_col_tag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | my ($self,$attribs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_col_tag: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | $self->{'global'}->{'colgroup'} = {} unless $self->{'colgroups'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | push @{$self->{'colgroups'}}, $attribs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | sub calc_totals { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | my ($self,$cols,$mask) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calc_totals: called CC=7 SCAR=24.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | ▶ | return undef unless $self->{'rows'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | $self->{'totals_mask'} = $mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | $cols = $self->_refinate($cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | my @indexes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | for (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | my $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | ▶ | if (exists $self->{'fields_hash'}->{$_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | $index = $self->{'fields_hash'}->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } elsif (exists $self->{'fields_hash'}->{lc $_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $index = $self->{'fields_hash'}->{lc $_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | SEARCH: for my $k (sort keys %{ $self->{'fields_hash'} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if (lc( $k ) eq lc( $_ )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $index = $self->{'fields_hash'}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | last SEARCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | push @indexes, $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | $self->{'totals'} = $self->_total_chunk($self->{'rows'},\@indexes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | sub calc_subtotals { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | my ($self,$cols,$mask,$nodups) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calc_subtotals: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | return undef unless $self->{'rows'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->{'subtotals_mask'} = $mask; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $cols = $self->_refinate($cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my @indexes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | for (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if (exists $self->{'fields_hash'}->{$_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $index = $self->{'fields_hash'}->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } elsif (exists $self->{'fields_hash'}->{lc $_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $index = $self->{'fields_hash'}->{lc $_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | SEARCH: for my $k (sort keys %{ $self->{'fields_hash'} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if (lc( $k ) eq lc( $_ )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $index = $self->{'fields_hash'}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | last SEARCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | push @indexes, $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my $beg = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | foreach my $end (@{$self->{'body_breaks'}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $chunk = ([@{$self->{'rows'}}[$beg..$end]]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | push @{$self->{'sub_totals'}}, $self->_total_chunk($chunk,\@indexes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $beg = $end + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | sub set_row_colors { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | my ($self,$colors,$myattrib) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_row_colors: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return $self unless ref $colors eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | return $self unless $#$colors >= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | my $ref = ($myattrib) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | ? { $myattrib => [@$colors] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | : { style => {background => [@$colors]} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $self->modify(tr => $ref, 'body'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # maybe that should be global? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | #$self->modify(tr => $ref); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | sub set_col_colors { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | my ($self,$colors,$myattrib) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_col_colors: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | return $self unless ref $colors eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | return $self unless $#$colors >= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my $cols = $self->_refinate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # trick #1: truncate colors to cols | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | $#$colors = $#$cols if $#$colors > $#$cols; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # trick #2: keep adding colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | #unless ($#$cols % 2 and $#$colors % 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $temp = [@$colors]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | push(@$colors,_rotate($temp)) until $#$colors == $#$cols; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | my $ref = ($myattrib) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ? { $myattrib => [@$colors] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | : { style => {background => [@$colors]} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->modify(td => $ref, $_) for @$cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | sub set_group { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | ▶ | my ($self,$group,$nodup,$value) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_group: called CC=10 SCAR=31.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | ▶ | $self->{'nodup'} = $value || $self->{'null_value'} if $nodup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$value || $self->{'null_value'}
MC/DC0%0/2
$value || $self->{'null_value'}
$value
$self->{'null_value'}
Truth table33%1/3
A || B
A= $valueB= $self->{'null_value'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | my $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | ▶ | if ($group =~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | $index = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } elsif (exists $self->{'fields_hash'}->{$group}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | $index = $self->{'fields_hash'}->{$group}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 1 | $self->{'group'} = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } elsif (exists $self->{'fields_hash'}->{lc $group}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $index = $self->{'fields_hash'}->{lc $group}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $self->{'group'} = lc $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | SEARCH: for my $k (sort keys %{ $self->{'fields_hash'} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | if (lc( $k ) eq lc( $group )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $index = $self->{'fields_hash'}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $self->{'group'} = $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | last SEARCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # initialize the first 'repetition' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 1 | my $rep = $self->{'rows'}->[0]->[$index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | # loop through the whole rows array, storing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # the points at which a new group starts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | for my $i (0..$self->get_row_count - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 2 | my $new = $self->{'rows'}->[$i]->[$index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | ▶ | push @{$self->{'body_breaks'}}, $i - 1 unless ($rep eq $new); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 2 | $rep = $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | push @{$self->{'body_breaks'}}, $self->get_row_count - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | sub set_pk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_pk: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | my $pk = shift || 'id'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'id'
MC/DC0%0/1
shift() || 'id'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | $pk = $pk =~ /^\d+$/ ? $self->_lookup_name($pk) || $pk : $pk; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_lookup_name($pk) or $pk
MC/DC0%0/2
$self->_lookup_name($pk) or $pk
$self->_lookup_name($pk)
$pk
Truth table0%0/3
A or B
A= $self->_lookup_name($pk)B= $pk
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | carp "can't call set_pk(): too late to set primary key" if exists $self->{'rows'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $self->{'pk'} = $pk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | sub set_null_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | my ($self,$value) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_null_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $self->{'null_value'} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | sub get_col_count { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_col_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | my $count = scalar @{$self->{'fields_arry'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | return $count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | sub get_row_count { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_row_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 6 | my $count = scalar @{$self->{'rows'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 6 | return $count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | sub get_current_row { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | return shift->{'current_row'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_current_row: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | sub get_current_col { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | return shift->{'current_col'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_current_col: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | sub add_cols { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | my ($self,$config) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_cols: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | $config = [$config] unless ref $config eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | foreach (@$config) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | next unless ref $_ eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my ($name,$data,$pos) = @$_{(qw(name data before))}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my $max_pos = $self->get_col_count(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | $pos = $self->_lookup_index(ucfirst $pos || '') || $max_pos unless defined $pos && $pos =~ /^\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/8
defined $pos and $pos =~ /^\d+$/
$self->_lookup_index(ucfirst $pos || '') || $max_pos
ucfirst $pos || ''
MC/DC0%0/2
defined $pos and $pos =~ /^\d+$/
defined $pos
$pos =~ /^\d+$/
MC/DC0%0/2
$self->_lookup_index(ucfirst $pos || '') || $max_pos
$self->_lookup_index(ucfirst $pos || '')
$max_pos
MC/DC0%0/1
ucfirst $pos || ''
ucfirst $pos
Truth table0%0/3
A and B
A= defined $posB= $pos =~ /^\d+$/
Truth table0%0/3
A || B
A= $self->_lookup_index(ucfirst $pos || '')B= $max_pos
Truth table0%0/2
A
A= ucfirst $pos
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | $pos = $max_pos if $pos > $max_pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | $data = [$data] unless ref $data eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | splice(@{$self->{'fields_arry'}},$pos,0,$name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $self->_reset_fields_hash(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | splice(@$_,$pos,0,_rotate($data)) for (@{$self->{rows}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | sub drop_cols { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | my ($self,$cols) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drop_cols: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $cols = $self->_refinate($cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | foreach my $col (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my $index = delete $self->{'fields_hash'}->{$col}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | splice(@{$self->{'fields_arry'}},$index,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $self->_reset_fields_hash(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | splice(@$_,$index,1) for (@{$self->{'rows'}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | ###################### DEPRECATED ################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | sub get_table { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | carp "get_table() is deprecated. Use output() instead"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_table: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | output(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | sub modify_tag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | carp "modify_tag() is deprecated. Use modify() instead"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modify_tag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | modify(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | sub map_col { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | carp "map_col() is deprecated. Use map_cell() instead"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_col: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | map_cell(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | #################### UNDER THE HOOD ################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # repeat: it only looks complicated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | sub _build_table { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 7 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_table: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 7 | my $attribs = $self->{'global'}->{'table'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 7 | my ($head,$body,$foot); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 7 | $head = $self->_build_head; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 7 | ▶ | $body = $self->{'rows'} ? $self->_build_body : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 7 | ▶ | $foot = $self->{'totals'} ? $self->_build_foot : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # w3c says tfoot comes before tbody ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 7 | my $cdata = $head . $foot . $body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 7 | return _tag_it('table', $attribs, $cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | sub _build_head { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 7 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_head: called CC=6 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 7 | my ($attribs,$cdata,$caption); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 7 | my $output = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # build the <caption> tag if applicable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 7 | ▶ | if ($caption = $self->{'global'}->{'caption'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $attribs = $self->{'global'}->{'caption_attribs'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | $cdata = $self->{'encode_cells'} ? $self->_xml_encode($caption) : $caption; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $output .= $N.$T . _tag_it('caption', $attribs, $cdata); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # build the <colgroup> tags if applicable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 7 | ▶ | if ($attribs = $self->{'global'}->{'colgroup'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $cdata = $self->_build_head_colgroups(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $output .= $N.$T . _tag_it('colgroup', $attribs, $cdata); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # go ahead and stop if they don't want the head | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 7 | ▶ | return "$output\n" if $self->{'no_head'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # prepare <tr> tag info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | my $tr_attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 7 | $self->{'head'}->{'tr'}, $self->{'global'}->{'tr'} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 7 | my $tr_cdata = $self->_build_head_row(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | # prepare the <thead> tag info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 7 | ▶ | $attribs = $self->{'head'}->{'thead'} || $self->{'global'}->{'thead'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'head'}{'thead'} || $self->{'global'}{'thead'}
MC/DC0%0/2
$self->{'head'}{'thead'} || $self->{'global'}{'thead'}
$self->{'head'}{'thead'}
$self->{'global'}{'thead'}
Truth table33%1/3
A || B
A= $self->{'head'}{'thead'}B= $self->{'global'}{'thead'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 7 | $cdata = $N.$T . _tag_it('tr', $tr_attribs, $tr_cdata) . $N.$T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # add the <thead> tag to the output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 7 | $output .= $N.$T . _tag_it('thead', $attribs, $cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | sub _build_head_colgroups { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_head_colgroups: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my (@cols,$output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | return unless $self->{'colgroups'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | return undef unless @cols = @{$self->{'colgroups'}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | foreach (@cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | $output .= $N.$T.$T . _tag_it('col', $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $output .= $N.$T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | sub _build_head_row { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 7 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_head_row: called CC=7 SCAR=20.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 7 | my $output = $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 7 | my @copy = @{$self->{'fields_arry'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 7 | foreach my $field (@copy) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | my $attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | $self->{$field}->{'th'} || $self->{'head'}->{'th'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 14 | ▶ | $self->{'global'}->{'th'} || $self->{'head'}->{'th'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{$field}{'th'} || $self->{'head'}{'th'}
$self->{'global'}{'th'} || $self->{'head'}{'th'}
MC/DC0%0/2
$self->{$field}{'th'} || $self->{'head'}{'th'}
$self->{$field}{'th'}
$self->{'head'}{'th'}
MC/DC0%0/2
$self->{'global'}{'th'} || $self->{'head'}{'th'}
$self->{'global'}{'th'}
$self->{'head'}{'th'}
Truth table33%1/3
A || B
A= $self->{$field}{'th'}B= $self->{'head'}{'th'}
Truth table33%1/3
A || B
A= $self->{'global'}{'th'}B= $self->{'head'}{'th'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 14 | ▶ | if (my $sub = $self->{'map_head'}->{$field}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 4 | $field = $sub->($field); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | elsif (!$self->{'no_ucfirst'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 10 | $field = ucfirst( lc( $field ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # bug 21761 "Special XML characters should be expressed as entities" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 14 | ▶ | $field = $self->_xml_encode( $field ) if $self->{'encode_cells'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 14 | $output .= $T.$T . _tag_it('th', $attribs, $field) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 7 | return $output . $T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | sub _build_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 7 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_body: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 7 | my $beg = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 7 | my $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # if a group was not set via set_group(), then use the entire 2-d array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | my @indicies = exists $self->{'body_breaks'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 7 | ▶ | ? @{$self->{'body_breaks'}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | : ($self->get_row_count - 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | # the skinny here is to grab a slice of the rows, one for each group | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 7 | foreach my $end (@indicies) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 7 | ▶ | my $body_group = $self->_build_body_group([@{$self->{'rows'}}[$beg..$end]]) || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_build_body_group([@{$$self{'rows'};}[$beg .. $end]]) || ''
MC/DC0%0/1
$self->_build_body_group([@{$$self{'rows'};}[$beg .. $end]]) || ''
$self->_build_body_group([@{$$self{'rows'};}[$beg .. $end]])
Truth table50%1/2
A
A= $self->_build_body_group([@{$$self{'rows'};}[$beg .. $end]])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 7 | ▶ | my $attribs = $self->{'global'}->{'tbody'} || $self->{'body'}->{'tbody'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'global'}{'tbody'} || $self->{'body'}{'tbody'}
MC/DC0%0/2
$self->{'global'}{'tbody'} || $self->{'body'}{'tbody'}
$self->{'global'}{'tbody'}
$self->{'body'}{'tbody'}
Truth table33%1/3
A || B
A= $self->{'global'}{'tbody'}B= $self->{'body'}{'tbody'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 7 | my $cdata = $N . $body_group . $T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 7 | $output .= $T . _tag_it('tbody',$attribs,$cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 7 | $beg = $end + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 7 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | sub _build_body_group { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 7 | ▶ | my ($self,$chunk) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_body_group: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 7 | my ($output,$cdata); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | my $attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 7 | $self->{'body'}->{'tr'}, $self->{'global'}->{'tr'} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 7 | my $pk_col = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # build the rows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 7 | for my $i (0..$#$chunk) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 14 | my @row = @{$chunk->[$i]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 14 | ▶ | $pk_col = splice(@row,$self->{'pk_index'},1) if defined $self->{'pk_index'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 14 | ▶ | $cdata = $self->_build_body_row(\@row, ($i and $self->{'nodup'} or 0), $pk_col); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
$i && $self->{'nodup'} || 0
$i and $self->{"nodup"}
MC/DC100%2/2
$i && $self->{'nodup'} || 0
$i
$self->{"nodup"}
Truth table100%3/3
A and B
A= $iB= $self->{"nodup"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 14 | $output .= $T . _tag_it('tr',$attribs,$cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # build the subtotal row if applicable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 7 | ▶ | if (my $subtotals = shift @{$self->{'sub_totals'}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | $cdata = $self->_build_body_subtotal($subtotals); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $output .= $T . _tag_it('tr',$attribs,$cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 7 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | sub _build_body_row { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 14 | ▶ | my ($self,$row,$nodup,$pk) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_body_row: called CC=10 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 14 | my $group = $self->{'group'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 14 | ▶ | my $index = $self->_lookup_index($group) if $group; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 14 | my $output = $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 14 | $self->{'current_row'} = $pk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 14 | for (0..$#$row) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 28 | my $name = $self->_lookup_name($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | my $attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | $self->{$name}->{'td'} || $self->{'body'}->{'td'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 28 | ▶ | $self->{'global'}->{'td'} || $self->{'body'}->{'td'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$self->{$name}{'td'} || $self->{'body'}{'td'}
$self->{'global'}{'td'} || $self->{'body'}{'td'}
MC/DC50%1/2
$self->{$name}{'td'} || $self->{'body'}{'td'}
$self->{$name}{'td'}
$self->{'body'}{'td'}
MC/DC50%1/2
$self->{'global'}{'td'} || $self->{'body'}{'td'}
$self->{'global'}{'td'}
$self->{'body'}{'td'}
Truth table66%2/3
A || B
A= $self->{$name}{'td'}B= $self->{'body'}{'td'}
Truth table66%2/3
A || B
A= $self->{'global'}{'td'}B= $self->{'body'}{'td'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | # suppress warnings AND keep 0 from becoming | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 28 | ▶ | $row->[$_] = '' unless defined($row->[$_]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # bug 21761 "Special XML characters should be expressed as entities" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 28 | ▶ | $row->[$_] = $self->_xml_encode( $row->[$_] ) if $self->{'encode_cells'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | my $cdata = ($row->[$_] =~ /^\s+$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 28 | ▶ | ? $self->{'null_value'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | : $row->[$_] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 28 | $self->{'current_col'} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | $cdata = ($nodup and $index == $_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | ? $self->{'nodup'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 28 | ▶ | : _map_it($self->{'map_cell'}->{$name},$cdata) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$nodup and $index == $_
MC/DC100%2/2
$nodup and $index == $_
$nodup
$index == $_
Truth table100%3/3
A and B
A= $nodupB= $index == $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 28 | $output .= $T.$T . _tag_it('td', $attribs, $cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 14 | return $output . $T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | sub _build_body_subtotal { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | my ($self,$row) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_body_subtotal: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | my $output = $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | return '' unless $row; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | for (0..$#$row) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my $name = $self->_lookup_name($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $sum = ($row->[$_]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | my $attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | $self->{$name}->{'th'} || $self->{'body'}->{'th'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | $self->{'global'}->{'th'} || $self->{'body'}->{'th'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->{$name}{'th'} || $self->{'body'}{'th'}
$self->{'global'}{'th'} || $self->{'body'}{'th'}
MC/DC0%0/2
$self->{$name}{'th'} || $self->{'body'}{'th'}
$self->{$name}{'th'}
$self->{'body'}{'th'}
MC/DC0%0/2
$self->{'global'}{'th'} || $self->{'body'}{'th'}
$self->{'global'}{'th'}
$self->{'body'}{'th'}
Truth table0%0/3
A || B
A= $self->{$name}{'th'}B= $self->{'body'}{'th'}
Truth table0%0/3
A || B
A= $self->{'global'}{'th'}B= $self->{'body'}{'th'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | # use sprintf if mask was supplied | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | if ($self->{'subtotals_mask'} and defined $sum) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"subtotals_mask"} and defined $sum
MC/DC0%0/2
$self->{"subtotals_mask"} and defined $sum
$self->{"subtotals_mask"}
defined $sum
Truth table0%0/3
A and B
A= $self->{"subtotals_mask"}B= defined $sum
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | $sum = sprintf($self->{'subtotals_mask'},$sum); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | $sum = (defined $sum) ? $sum : $self->{'null_value'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $output .= $T.$T . _tag_it('th', $attribs, $sum) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | return $output . $T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | sub _build_foot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_foot: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | my $tr_attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # notice that foot is 1st and global 2nd - different than rest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | $self->{'foot'}->{'tr'}, $self->{'global'}->{'tr'} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 2 | my $tr_cdata = $self->_build_foot_row(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 2 | ▶ | my $attribs = $self->{'foot'}->{'tfoot'} || $self->{'global'}->{'tfoot'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'foot'}{'tfoot'} || $self->{'global'}{'tfoot'}
MC/DC0%0/2
$self->{'foot'}{'tfoot'} || $self->{'global'}{'tfoot'}
$self->{'foot'}{'tfoot'}
$self->{'global'}{'tfoot'}
Truth table33%1/3
A || B
A= $self->{'foot'}{'tfoot'}B= $self->{'global'}{'tfoot'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 2 | my $cdata = $N.$T . _tag_it('tr', $tr_attribs, $tr_cdata) . $N.$T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 2 | return $T . _tag_it('tfoot',$attribs,$cdata) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | sub _build_foot_row { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_foot_row: called CC=7 SCAR=21.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 2 | my $output = $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 2 | my $row = $self->{'totals'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 2 | for (0..$#$row) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 4 | my $name = $self->_lookup_name($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | my $attribs = _merge_attribs( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | $self->{$name}->{'th'} || $self->{'foot'}->{'th'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 4 | ▶ | $self->{'global'}->{'th'} || $self->{'foot'}->{'th'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{$name}{'th'} || $self->{'foot'}{'th'}
$self->{'global'}{'th'} || $self->{'foot'}{'th'}
MC/DC0%0/2
$self->{$name}{'th'} || $self->{'foot'}{'th'}
$self->{$name}{'th'}
$self->{'foot'}{'th'}
MC/DC0%0/2
$self->{'global'}{'th'} || $self->{'foot'}{'th'}
$self->{'global'}{'th'}
$self->{'foot'}{'th'}
Truth table33%1/3
A || B
A= $self->{$name}{'th'}B= $self->{'foot'}{'th'}
Truth table33%1/3
A || B
A= $self->{'global'}{'th'}B= $self->{'foot'}{'th'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 4 | my $sum = ($row->[$_]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | # use sprintf if mask was supplied | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 4 | ▶ | if ($self->{'totals_mask'} and defined $sum) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"totals_mask"} and defined $sum
MC/DC0%0/2
$self->{"totals_mask"} and defined $sum
$self->{"totals_mask"}
defined $sum
Truth table33%1/3
A and B
A= $self->{"totals_mask"}B= defined $sum
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | $sum = sprintf($self->{'totals_mask'},$sum) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 4 | ▶ | $sum = defined $sum ? $sum : $self->{'null_value'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 4 | $output .= $T.$T . _tag_it('th', $attribs, $sum) . $N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 2 | return $output . $T; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | # builds a tag and it's enclosed data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | sub _tag_it { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 92 | ▶ | my ($name,$attribs,$cdata) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tag_it: called CC=8 SCAR=21.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 92 | my $text = "<\L$name\E"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | # build the attributes if any - skip blank vals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 92 | for my $k (sort keys %{$attribs}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 4 | my $v = $attribs->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 4 | ▶ | if (ref $v eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | $v = join('; ', map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 4 | my $attrib = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | my $value = (ref $v->{$_} eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | ? _rotate($v->{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 4 | ▶ | : $v->{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 4 | ▶ | join(': ',$attrib,$value||''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$value || ''
MC/DC0%0/1
$value || ''
$value
Truth table50%1/2
A
A= $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } sort keys %$v) . ';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 4 | ▶ | $v = _rotate($v) if (ref $v eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 4 | ▶ | $text .= qq| \L$k\E="$v"| unless $v =~ /^$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 92 | ▶ | $text .= (defined $cdata) ? ">$cdata</\L$name\E>" : '/>'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # used by map_cell() and map_head() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | sub _map_it { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 25 | ▶ | my ($sub,$datum) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_it: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 25 | ▶ | return $datum unless $sub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | return $datum = $sub->($datum); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # used by calc_totals() and calc_subtotals() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | sub _total_chunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 1 | ▶ | my ($self,$chunk,$indexes) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_total_chunk: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 1 | my %totals; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 1 | foreach my $row (@$chunk) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 2 | foreach (@$indexes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 2 | ▶ | $totals{$_} += $row->[$_] if $row->[$_] =~ /^[-0-9\.]+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 1 | ▶ | return [ map { defined $totals{$_} ? $totals{$_} : undef } (0 .. $self->get_col_count() - 1) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | # uses %ESCAPES to convert the '4 Horsemen' of XML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | # big thanks to Matt Sergeant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | sub _xml_encode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 6 | ▶ | my ($self,$str) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_xml_encode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 6 | $str =~ s/([&<>"])/$ESCAPES{$1}/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 6 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | # returns value of and moves first element to last | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | sub _rotate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 4 | ▶ | my $ref = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rotate: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 4 | my $next = shift @$ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 4 | push @$ref, $next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 4 | return $next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # always returns an array ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | sub _refinate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 3 | ▶ | my ($self,$ref) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_refinate: called CC=7 SCAR=25.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 3 | ▶ | $ref = undef if ref($ref) eq 'ARRAY' && scalar( @$ref ) < 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $ref eq "ARRAY" and scalar @$ref < 1
MC/DC0%0/2
ref $ref eq "ARRAY" and scalar @$ref < 1
ref $ref eq "ARRAY"
scalar @$ref < 1
Truth table33%1/3
A and B
A= ref $ref eq "ARRAY"B= scalar @$ref < 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 3 | ▶ | $ref = [@{$self->{'fields_arry'}}] unless defined $ref; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 3 | ▶ | $ref = [$ref] unless ref $ref eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 3 | ▶ | return [map {$_ =~ /^\d+$/ ? $self->_lookup_name($_) || $_ : $_} @$ref]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_lookup_name($_) or $_
MC/DC0%0/2
$self->_lookup_name($_) or $_
$self->_lookup_name($_)
$_
Truth table0%0/3
A or B
A= $self->_lookup_name($_)B= $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | sub _merge_attribs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 62 | ▶ | my ($hash1,$hash2) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_merge_attribs: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 62 | ▶ | return $hash1 unless $hash2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 4 | ▶ | return $hash2 unless $hash1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 4 | return {%$hash2,%$hash1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | sub _lookup_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 32 | ▶ | my ($self,$index) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lookup_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 32 | return $self->{'fields_arry'}->[$index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | sub _lookup_index { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 6 | ▶ | my ($self,$name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lookup_index: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 6 | return $self->{'fields_hash'}->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | sub _reset_fields_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reset_fields_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 2 | $self->{fields_hash} = { map { $_ => $i++ } @{$self->{fields_arry}} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # assigns a non-DBI supplied data table (2D array ref) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | sub _do_black_magic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 2 | ▶ | my ($self,$ref,$headers) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_black_magic: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 2 | ▶ | croak "bad data" unless ref( $ref->[0] ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 2 | ▶ | $self->{'fields_arry'} = $headers ? [@$headers] : [ @{ shift @$ref } ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 2 | $self->{'fields_hash'} = $self->_reset_fields_hash(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 2 | $self->{'rows'} = $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # disconnect database handle if i created it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 2 | ▶ | unless ($self->{'keep_alive'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 2 | ▶ | $self->{'dbh'}->disconnect if defined $self->{'dbh'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||