Nonogram/Loader/File.pm

filter: Statementstmt 33.3% 7 / 21 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 28.5% 10 / 35 CC 6 SCAR 34.6
CC
6
Cov
23%
load
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 31.8
« Nonogram/Clue.pm ↑ Summary Nonogram.pm »
1 package Games::Nonogram::Loader::File;
2
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 0 ▶sub load {
Subroutine load: not called CC=6 SCAR=37.4
Pod documented
7 0 my ($class, $file) = @_;
8
9 0 my ($height, $width, @lines);
10 0 ▶ open my $fh, '<', $file or die "Cannot open $file";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $file or die "Cannot open $file" 0 0 0
11 0 ▶ while(<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
12 0 chomp;
13 0 ▶ next if /^#/;
Branch: 1 branch
BranchTrueFalseTotal
if /^#/ 0 0 0
14 0 ▶ if ( $_ eq '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ eq "") 0 0 0
15 0 ▶ unless ( $height ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($height) 0 0 0
16 0 $height = scalar @lines;
17 0 next;
18 }
19 0 last; # should be the end of the column clues
20 }
21 0 push @lines, $_;
22 }
23 0 $width = (scalar @lines) - $height;
24
25 0 return ($height, $width, @lines);
26 }
27
28 2 1;
29
30 __END__
« Nonogram/Clue.pm ↑ Summary Nonogram.pm »