blib/lib/Chess/NumberMoves.pm

filter: Statementstmt 59.3% 19 / 32 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 50.0% 23 / 46 CC 5 SCAR 25.3
CC
5
Cov
48%
from_file
21.7
BEGIN
1.0
BEGIN
1.0
CRAP 12.5
↑ Summary
1 package Chess::NumberMoves;
2  
3 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 require Exporter;
8  
9 1 our @ISA = qw(Exporter);
10  
11 # Items to export into callers namespace by default. Note: do not export
12 # names by default without a very good reason. Use EXPORT_OK instead.
13 # Do not simply export all your public functions/methods/constants.
14  
15 # This allows declaration use Chess::NumberMoves ':all';
16 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
17 # will save memory.
18 1 our %EXPORT_TAGS = ( 'all' => [ qw(
19
20 ) ] );
21  
22 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
23  
24 1 our @EXPORT = qw(
25
26 );
27  
28 1 our $VERSION = '0.03';
29  
30  
31 # Preloaded methods go here.
32  
33 0 ▶sub from_file {
Subroutine from_file: not called CC=5 SCAR=30.8
Pod undocumented
34  
35 0 my $file = shift;
36 1 ▶ use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 0 my $fh = new FileHandle "< $file";
38 0 ▶ $fh or die $!;
Branch: 1 branch
BranchTrueFalseTotal
$fh or die $! 0 0 0
39  
40 0 my @line;
41
42 0 my $line = 1;
43 0 my $space = ' '; # 2 spaces to start with
44 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
45  
46 0 ▶ if (/^[A-Z]/i)
Branch: 1 branch
BranchTrueFalseTotal
if (/^[A-Z]/i) 0 0 0
47 {
48
49 0 ▶ $line == 10 and $space = ' '; # now one space
Branch: 1 branch
BranchTrueFalseTotal
$line == 10 and $space = " " 0 0 0
50 0 $_ = "$line.$space$_";
51 0 ++$line;
52 }
53  
54 0 push @line, $_;
55 }
56
57 0 join '', @line;
58  
59 }
60  
61 1 1;
62  
63 __END__
↑ Summary