Branch Coverage

blib/lib/Spreadsheet/WriteExcel/Worksheet.pm
Criterion Covered Total %
branch 474 908 52.2


line true false branch
205 0 143 if (defined $$self{'_tempdir'}) { }
209 0 0 if $@
217 0 0 unless $fh
224 0 143 unless $fh
229 143 0 if ($fh) { }
242 0 0 if ($$self{'_index'} == 0 and $^W)
281 4 129 if (@{$$self{'_colinfo'};})
363 0 133 if @{$$self{'_panes'};}
389 0 0 if (defined $_[0]) { }
430 135 267 if (defined $$self{'_data'})
434 132 3 if $$self{'_using_tmpfile'}
439 264 3 if ($$self{'_using_tmpfile'})
440 132 132 if read $$self{'_filehandle'}, $tmp, $buffer
529 0 0 if defined $_[0]
548 3 2 if ($cell =~ /^\D/)
556 0 5 if @data < 3
557 0 5 unless defined $data[0]
558 0 5 unless defined $data[1]
561 0 5 if $data[1] == 0
564 0 5 if $data[0] > $data[1]
567 0 5 if $data[0] > 255
568 0 5 if $data[1] > 255
576 0 5 $data[4] ? :
584 1 9 if defined $format
601 0 0 if ($_[0] =~ /^\D/)
620 0 0 if ($_[0] =~ /^\D/)
625 0 0 if $_[4]
689 0 0 defined $_[0] ? :
704 0 0 if $color == 32767
738 0 0 if ($] >= 5.008)
741 0 0 if (Encode::is_utf8($string))
747 0 0 $encoding ? :
749 0 0 if (length $string >= $limit)
774 0 0 if ($] >= 5.008)
777 0 0 if (Encode::is_utf8($string))
783 0 0 $encoding ? :
786 0 0 if (length $string >= $limit)
807 0 0 if (defined $_[0]) { }
826 0 0 if (defined $_[0]) { }
892 0 0 defined $_[0] ? :
906 0 0 defined $_[0] ? :
920 0 0 defined $_[0] ? :
934 0 0 defined $_[0] ? :
966 2 3 if ($_[0] =~ /^\D/)
991 10 0 if ($_[0] =~ /^\D/)
995 0 10 if @_ != 4
1015 3 0 if ($_[0] =~ /^\D/)
1019 0 3 if @_ != 4
1024 0 3 if $row2 < $row1
1025 0 3 if $col2 < $col1
1046 0 0 unless $$self{'_filter_count'}
1048 0 0 unless @_ == 2
1052 0 0 if ($col =~ /^\D/)
1060 0 0 if ($col < $col_first or $col > $col_last)
1068 0 0 unless @tokens == 3 or @tokens == 7
1098 2 69 unless $expression
1133 7 46 if (@tokens == 7) { }
1137 4 3 if ($conditional =~ /^(and|&&)$/) { }
3 0 elsif ($conditional =~ /^(or|\|\|)$/) { }
1195 11 49 if ($tokens[0] =~ /^top|bottom$/i)
1199 0 11 if ($value =~ /\D/ or $value < 1 or $value > 500)
1209 0 11 if ($token ne 'items' and $token ne '%')
1214 7 4 if ($tokens[0] =~ /^top$/i) { }
1221 4 7 if ($tokens[2] eq '%')
1229 0 0 if (not $operator and $tokens[0])
1236 6 54 if ($token =~ /^blanks|nonblanks$/i)
1239 0 6 if ($operator != 2 and $operator != 5)
1248 3 3 if ($token eq 'blanks') { }
1249 1 2 if ($operator == 5)
1255 1 2 if ($operator == 5)
1265 5 55 if ($operator == 2 and $token =~ /[*?]/)
1291 0 0 unless defined $option
1293 0 0 if ($option == 0) { }
0 0 elsif ($option == 1) { }
1319 0 0 if (defined $_[0]) { }
1385 0 0 if ($scale < 10 or $scale > 400)
1406 0 0 if ($scale < 10 or $scale > 400)
1429 0 0 if (defined $_[0]) { }
1448 0 0 defined $_[0] ? :
1462 0 0 defined $_[0] ? :
1463 0 0 $_[1] ? :
1477 0 0 defined $_[0] ? :
1491 0 0 defined $_[0] ? :
1505 0 0 defined $_[0] ? :
1518 0 0 unless defined $_[0]
1539 0 0 if $row > 65535
1540 0 0 if $col > 255
1557 0 0 unless @_ == 2
1558 0 0 unless ref $_[1] eq 'CODE'
1582 7 29 if ($_[0] =~ /^\D/)
1589 0 36 unless defined $token
1597 0 0 if ($token =~ /$re/)
1599 0 0 if defined $match
1605 0 36 if (ref $token eq 'ARRAY') { }
0 36 elsif ($$self{'_leading_zeros'} and $token =~ /^0\d+$/) { }
0 36 elsif ($token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { }
0 36 elsif ($token =~ m[^[fh]tt?ps?://] and not $$self{'_writing_url'}) { }
0 36 elsif ($token =~ /^mailto:/ and not $$self{'_writing_url'}) { }
0 36 elsif ($token =~ /^(?:in|ex)ternal:/ and not $$self{'_writing_url'}) { }
0 36 elsif ($token =~ /^=/) { }
0 36 elsif ($token eq '') { }
1659 0 0 if ($_[0] =~ /^\D/)
1664 0 0 if (ref $_[2] ne 'ARRAY')
1678 0 0 if (ref $token eq 'ARRAY') { }
1709 0 0 if ($_[0] =~ /^\D/)
1714 0 0 if (ref $_[2] ne 'ARRAY')
1755 0 22541 if ($_[0] =~ /^\D/)
1759 0 22541 if (@_ < 3)
1766 0 22541 unless @_ % 2
1770 0 22541 if $self->_check_dimensions($row, $col)
1797 22 37 if (ref $format) { }
2 35 elsif (exists $$self{'_row_formats'}{$row}) { }
1 34 elsif (exists $$self{'_col_formats'}{$col}) { }
1799 1 21 if $$format{'_used_merge'} == 1
1806 2 0 if $$self{'_row_formats'}{$row}{'_used_merge'} == 1
1813 1 0 if $$self{'_col_formats'}{$col}{'_used_merge'} == 1
1843 562 323 if ($$self{'_using_tmpfile'}) { }
1847 0 562 if length $data > $$self{'_limit'}
1879 6 77 if ($cell =~ /\$?([A-I]?[A-Z]):\$?([A-I]?[A-Z])/)
1886 19 58 if ($cell =~ /\$?([A-I]?[A-Z]\$?\d+):\$?([A-I]?[A-Z]\$?\d+)/)
1893 58 0 if ($cell =~ /\$?([A-I]?[A-Z]\$?\d+)/)
1962 0 0 if $array[0] == 0
1966 0 0 if @array > 1000
2022 0 0 defined $_[0] ? :
2023 0 0 defined $_[1] ? :
2024 0 0 defined $_[2] ? :
2028 0 0 if $$self{'_outline_on'}
2058 0 1 if ($_[0] =~ /^\D/)
2062 0 1 if (@_ < 3)
2073 0 1 if $self->_check_dimensions($row, $col)
2079 0 1 if ($$self{'_byte_order'})
2082 0 1 if ($$self{'_compatibility'}) { }
2109 0 41 if ($_[0] =~ /^\D/)
2113 1 40 if (@_ < 3)
2128 36 0 if ($] >= 5.008)
2131 0 36 if (Encode::is_utf8($str))
2139 2 34 if $self->_check_dimensions($row, $col)
2142 0 34 if ($strlen > 32767)
2153 5 29 unless (exists $${$$self{'_str_table'};}{$str})
2166 12 22 if ($$self{'_compatibility'}) { }
2198 0 14 if ($_[0] =~ /^\D/)
2203 0 14 if @_ < 2
2206 0 14 unless defined $_[2]
2217 0 14 if $self->_check_dimensions($row, $col)
2223 0 14 if ($$self{'_compatibility'}) { }
2255 0 1 if ($_[0] =~ /^\D/)
2259 0 1 if (@_ < 3)
2261 0 1 unless defined $_[2]
2290 0 1 if $self->_check_dimensions($row, $col)
2305 0 1 if ($@)
2321 0 1 if $is_string
2325 0 1 if ($$self{'_compatibility'}) { }
2351 2 0 if (not defined $value) { }
2360 0 0 if ($value =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { }
2378 0 0 if (exists $bools{$value}) { }
2419 0 0 if ($] >= 5.008)
2422 0 0 if (Encode::is_utf8($string))
2462 0 4 if ($@)
2491 0 1 if ($_[0] =~ /^\D/)
2495 0 1 if (@_ < 2)
2508 0 1 if @pairs % 2
2511 0 1 if ref $formula_ref ne 'ARRAY'
2516 0 1 unless @tokens
2523 0 1 if (@pairs and $pairs[-2] eq 'result')
2534 1 1 if $token =~ s/$pattern/$replace/
2543 0 1 unless defined $formula
2562 0 1 if $self->_check_dimensions($row, $col)
2576 0 1 if $is_string
2580 0 1 if ($$self{'_compatibility'}) { }
2615 0 1 if ($_[0] =~ /^\D/)
2620 0 1 if @_ < 3
2643 0 1 if ($_[0] =~ /^\D/)
2648 0 1 if @_ < 5
2657 0 1 if ref $args[5]
2663 0 1 if $url =~ /^internal:/
2664 0 1 if $url =~ /^external:/
2696 1 0 unless defined $str
2700 0 1 if $error == -2
2716 1 0 if ($] >= 5.008)
2719 0 1 if (Encode::is_utf8($url))
2727 1 0 if ($encoding == 0)
2787 0 0 unless defined $str
2791 0 0 if $error == -2
2807 0 0 if ($] >= 5.008)
2810 0 0 if (Encode::is_utf8($url))
2812 0 0 unless $url =~ /^'/
2822 0 0 if ($encoding == 0)
2871 0 0 if $_[4] =~ /^external:\\\\/
2893 0 0 unless defined $str
2897 0 0 if $error == -2
2905 0 0 if $url =~ /^[A-Za-z]:/
2916 0 0 if (defined $sheet) { }
3023 0 0 unless defined $str
3027 0 0 if $error == -2
3038 0 0 if (defined $sheet) { }
3109 0 0 if ($_[0] =~ /^\D/)
3113 0 0 if (@_ < 3)
3121 0 0 if $self->_check_dimensions($row, $col)
3126 0 0 if (defined $date_time) { }
3177 0 630 if $date_time =~ /[^0-9T:\-\.Z]/
3180 0 630 unless $date_time =~ /\dT|T\d/
3191 206 424 if ($time ne '')
3193 206 0 if ($time =~ /^(\d\d):(\d\d)(:(\d\d(\.\d+)?))?/) { }
3203 1 205 if $hour >= 24
3204 1 204 if $min >= 60
3205 2 202 if $sec >= 60
3213 2 624 if $date eq ''
3217 622 2 if ($date =~ /^(\d\d\d\d)-(\d\d)-(\d\d)$/) { }
3231 413 209 unless ($date_1904)
3232 104 309 if $date eq '1899-12-31'
3233 1 308 if $date eq '1900-01-00'
3234 1 307 if $date eq '1900-02-29'
3243 209 307 $date_1904 ? :
3244 209 307 $date_1904 ? :
3252 211 305 if $year % 4 == 0 and $year % 100 or $year % 400 == 0
3253 211 305 if $leap
3257 6 510 if $year < $epoch or $year > 9999
3258 6 504 if $month < 1 or $month > 12
3259 6 498 if $day < 1 or $day > $mdays[$month - 1]
3272 295 203 if $date_1904 == 0 and $days > 59
3309 0 15 unless defined $row
3312 0 15 if $self->_check_dimensions($row, 0, 0, 1)
3315 1 14 if (ref $format) { }
3326 14 1 if (defined $height) { }
3336 0 15 if $level < 0
3337 0 15 if $level > 7
3339 0 15 if $level > $$self{'_outline_row_level'}
3351 0 15 if $collapsed
3352 0 15 if $hidden
3354 1 14 if $format
3364 2 13 if ($$self{'_compatibility'}) { }
3375 1 14 if defined $format
3431 1 22696 unless defined $row
3432 0 22696 if $row >= $$self{'_xls_rowmax'}
3434 1 22695 unless defined $col
3435 0 22695 if $col >= $$self{'_xls_colmax'}
3438 22609 86 unless ($ignore_row)
3440 68 22541 if (not defined $$self{'_dim_rowmin'} or $row < $$self{'_dim_rowmin'})
3444 20535 2074 if (not defined $$self{'_dim_rowmax'} or $row > $$self{'_dim_rowmax'})
3449 22594 101 unless ($ignore_col)
3451 62 22532 if (not defined $$self{'_dim_colmin'} or $col < $$self{'_dim_colmin'})
3455 69 22525 if (not defined $$self{'_dim_colmax'} or $col > $$self{'_dim_colmax'})
3487 94 70 if (defined $$self{'_dim_rowmin'}) { }
3490 94 70 if (defined $$self{'_dim_rowmax'}) { }
3493 90 74 if (defined $$self{'_dim_colmin'}) { }
3496 90 74 if (defined $$self{'_dim_colmax'}) { }
3583 133 0 unless $$self{'_page_view'}
3602 135 0 unless $color
3686 0 5 if ($width < 1) { }
3706 1 4 if (ref $format) { }
3715 0 5 if $level < 0
3716 0 5 if $level > 7
3720 0 5 if $hidden
3722 0 5 if $collapsed
3748 133 0 unless $$self{'_filter_on'}
3771 130 3 unless $$self{'_filter_count'}
3804 0 133 if ($rwFirst > $rwLast)
3808 0 133 if ($colFirst > $colLast)
3875 0 0 if ($$self{'_name'} eq $sheetname) { }
3919 0 0 if ($$self{'_frozen'}) { }
3921 0 0 unless defined $rwTop
3922 0 0 unless defined $colLeft
3926 0 0 unless defined $rwTop
3927 0 0 unless defined $colLeft
3942 0 0 unless (defined $pnnAct)
3943 0 0 if $x != 0 and $y != 0
3944 0 0 if $x != 0 and $y == 0
3945 0 0 if $x == 0 and $y != 0
3946 0 0 if $x == 0 and $y == 0
4009 0 135 if ($$self{'_byte_order'})
4049 0 135 if $encoding
4052 0 135 if $encoding
4082 0 135 if $encoding
4085 0 135 if $encoding
4158 0 135 if ($$self{'_byte_order'})
4182 0 135 if ($$self{'_byte_order'})
4206 0 135 if ($$self{'_byte_order'})
4230 0 135 if ($$self{'_byte_order'})
4248 0 3 if ($_[0] =~ /^\D/)
4263 0 3 if $rwFirst == $rwLast and $colFirst == $colLast
4266 0 3 if $rwFirst > $rwLast
4267 0 3 if $colFirst > $colLast
4292 4 0 if ($_[0] =~ /^\D/)
4295 0 4 if @_ != 6 and @_ != 7
4296 0 4 unless ref $_[5]
4304 0 4 $_[6] ? :
4311 1 3 if $$format{'_used_merge'} == -1
4319 0 3 if $rwFirst == $rwLast and $colFirst == $colLast
4323 0 3 if $rwFirst > $rwLast
4324 0 3 if $colFirst > $colLast
4327 0 3 if ($encoding) { }
4337 3 14 if $row == $rwFirst and $col == $colFirst
4448 5 0 if @{$colinfo;} < 6
4449 0 0 if @{$colinfo;}[5] > $col_level
4454 0 133 if $col_level < 0
4455 0 133 if $col_level > 7
4459 0 133 if $row_level > 0
4460 0 133 if $col_level > 0
4488 0 133 if $$self{'_outline_style'}
4489 133 0 if $$self{'_outline_below'}
4490 133 0 if $$self{'_outline_right'}
4491 0 133 if $$self{'_fit_page'}
4492 133 0 if $$self{'_outline_on'}
4513 133 0 unless @{$$self{'_hbreaks'};}
4546 133 0 unless @{$$self{'_vbreaks'};}
4579 133 0 unless $$self{'_protect'}
4604 133 0 unless $$self{'_protect'}
4629 135 0 unless $$self{'_protect'} and defined $$self{'_password'}
4679 126 7 unless $$self{'_compatibility'}
4692 28 7 unless $$self{'_table'}[$row] or $$self{'_row_data'}{$row}
4705 2 5 if ($$self{'_row_data'}{$row}) { }
4721 7 0 if (@written_rows == 32 or $row == $$self{'_dim_rowmax'} - 1)
4734 518 9 unless $col
4800 126 7 unless $$self{'_compatibility'}
4838 0 0 if ($_[0] =~ /^\D/)
4850 0 0 unless @_ >= 3
4852 0 0 if (ref $chart) { }
4854 0 0 unless $chart->isa('Spreadsheet::WriteExcel::Chart')
4858 0 0 unless $$chart{'_embedded'}
4865 0 0 unless -e $chart
4894 0 0 if ($_[0] =~ /^\D/)
4906 0 0 unless @_ >= 3
4907 0 0 unless -e $image
5030 0 22589 if $self->_size_col($col_start) == 0
5031 0 22589 if $self->_size_col($col_end) == 0
5032 0 22589 if $self->_size_row($row_start) == 0
5033 0 22589 if $self->_size_row($row_end) == 0
5069 17 225807 if (exists $$self{'_col_sizes'}{$col}) { }
5073 0 17 if ($width < 1) { }
5101 11 316077 if (exists $$self{'_row_sizes'}{$row}) { }
5102 0 11 if ($$self{'_row_sizes'}{$row} == 0) { }
5128 137 0 if $$self{'_zoom'} == 100
5156 0 2 if ($_[0] =~ /^\D/)
5160 0 2 if (@_ < 3)
5174 0 2 if $self->_check_dimensions($row, $col)
5177 0 2 if ($strlen > 65534)
5188 0 2 if $num_bytes % 2
5200 2 0 unless (exists $${$$self{'_str_table'};}{$str})
5212 0 2 if ($$self{'_compatibility'}) { }
5239 0 1 if ($_[0] =~ /^\D/)
5243 0 1 if (@_ < 3)
5280 133 0 unless $$self{'_filter_on'}
5289 0 0 unless $$self{'_filter_cols'}{$col}
5338 6 23 if $operator_1 == 2
5339 1 28 if defined $operator_2 and $operator_2 == 2
5343 5 24 if $operator_1 == 22
5344 0 29 if defined $operator_2 and $operator_2 == 22
5348 7 22 if ($operator_1 >= 30)
5356 5 2 if ($operator_1 == 30 or $operator_1 == 31)
5360 2 5 if ($operator_1 == 31 or $operator_1 == 33)
5364 5 2 if ($top10_direction == 1) { }
5419 26 32 unless (defined $operator)
5424 2 30 if ($token =~ /^blanks|nonblanks$/i) { }
14 16 elsif ($operator == 2 or not $token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { }
5438 14 0 if ($] >= 5.008)
5441 0 14 if (Encode::is_utf8($string))
5487 1 1 if ($token eq 'blanks') { }
5540 0 16 if $$self{'_byte_order'}
5680 133 0 unless $num_images
5695 0 0 if $scale_x
5696 0 0 if $scale_y
5708 0 0 if ($i == 0) { }
5790 133 0 unless $num_charts
5803 0 0 if $scale_x
5804 0 0 if $scale_y
5816 0 0 if ($i == 0 and not $num_objects) { }
5871 0 0 if ($$self{'_encoding'} and $] >= 5.008)
5895 0 0 if (ref $chart) { }
5902 0 0 unless my $filehandle = 'FileHandle'->new($chart)
5940 130 3 unless $num_filters
5956 3 6 if ($i == 0 and not $num_objects) { }
6041 132 1 unless $num_comments
6053 0 1 if $encoding
6057 1 0 if ($i == 0 and not $num_objects) { }
6275 0 2 if (defined $visible) { }
6276 0 0 $visible ? :
6279 0 2 $$self{'_comments_visible'} ? :
6683 0 9 if ($$self{'_filter_cols'}{$col}) { }
6877 1 5 if (defined $visible) { }
6878 1 0 $visible ? :
6881 0 5 $$self{'_comments_visible'} ? :
6887 2 4 if $author_enc
6947 0 22562 unless $params{'width'}
6948 0 22562 unless $params{'height'}
6952 0 22562 if ($params{'encoding'})
6953 0 0 if length($string) % 2
6960 1 22561 if ($params{'author_encoding'})
6961 0 1 if length($params{'author'}) % 2
6970 22562 0 if ($] >= 5.008)
6973 0 22562 if (Encode::is_utf8($string))
6978 1 22561 if (Encode::is_utf8($params{'author'}))
6987 0 22562 if $params{'encoding'}
6989 0 22562 if (length $string > $max_len)
6997 22562 0 if $color == 32767
7002 0 22562 if (defined $params{'start_cell'})
7013 22562 0 unless (defined $params{'start_row'})
7015 37 22525 if ($row == 0) { }
1 22524 elsif ($row == 65533) { }
1 22523 elsif ($row == 65534) { }
1 22522 elsif ($row == 65535) { }
7022 22561 1 unless (defined $params{'y_offset'})
7024 37 22524 if ($row == 0) { }
1 22523 elsif ($row == 65533) { }
1 22522 elsif ($row == 65534) { }
1 22521 elsif ($row == 65535) { }
7031 22562 0 unless (defined $params{'start_col'})
7033 1 22561 if ($col == 253) { }
1 22560 elsif ($col == 254) { }
1 22559 elsif ($col == 255) { }
7039 22561 1 unless (defined $params{'x_offset'})
7041 1 22560 if ($col == 253) { }
1 22559 elsif ($col == 254) { }
1 22558 elsif ($col == 255) { }
7049 22562 0 if ($params{'x_scale'})
7053 22562 0 if ($params{'y_scale'})
7109 38 5 if ($_[0] =~ /^\D/)
7114 0 43 if (@_ != 5 and @_ != 3)
7121 38 5 unless (defined $row2)
7127 0 43 if $self->_check_dimensions($row1, $col1, 1, 1)
7128 0 43 if $self->_check_dimensions($row2, $col2, 1, 1)
7132 0 43 if (ref $param ne 'HASH')
7159 0 171 unless (exists $valid_parameter{$param_key})
7166 3 40 if defined $$param{'source'}
7167 19 24 if defined $$param{'minimum'}
7170 0 43 unless (exists $$param{'validate'})
7194 0 43 if (not exists $valid_type{lc $$param{'validate'}}) { }
7206 1 42 if $$param{'validate'} == 0
7211 4 38 if ($$param{'validate'} == 3 or $$param{'validate'} == 7)
7217 0 42 unless (exists $$param{'criteria'})
7244 0 42 if (not exists $criteria_type{lc $$param{'criteria'}}) { }
7255 23 19 if ($$param{'criteria'} == 0 or $$param{'criteria'} == 1) { }
7256 0 23 unless (exists $$param{'maximum'})
7276 40 2 if (not exists $$param{'error_type'}) { }
0 2 elsif (not exists $error_type{lc $$param{'error_type'}}) { }
7290 5 37 if ($$param{'validate'} == 4 or $$param{'validate'} == 5)
7291 3 2 if ($$param{'value'} =~ /T/)
7294 0 3 if (not defined $date_time) { }
7303 1 4 if (defined $$param{'maximum'} and $$param{'maximum'} =~ /T/)
7306 0 1 if (not defined $date_time) { }
7319 41 1 unless defined $$param{'ignore_blank'}
7320 41 1 unless defined $$param{'dropdown'}
7321 40 2 unless defined $$param{'show_input'}
7322 41 1 unless defined $$param{'show_error'}
7329 3 39 if (exists $$param{'other_cells'})
7355 132 1 unless $dv_count
7371 133 43 unless scalar @{$$self{'_validations'};}
7457 2 41 if ($validation_type == 3 and ref $formula_1 eq 'ARRAY')
7529 156 24 if (not defined $string or $string eq '')
7534 2 178 if (length $string > $max_length)
7541 180 0 if ($] >= 5.008)
7544 2 178 if (Encode::is_utf8($string))
7574 25 73 if (not defined $formula or $formula eq '')
7579 4 69 if (ref $formula eq 'ARRAY')
7595 0 73 if ($@) { }