| 1 | package Games::Nonogram::Base; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 6 | 7 | my ($Conf, $Debug, $Stash, $Log); | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub conf { shift; @_ ? $Conf = shift : $Conf; } | ||||||||||||||||||||||||||
|
Subroutine
conf: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | sub debug { shift; @_ ? $Debug = shift : $Debug; } | ||||||||||||||||||||||||||
|
Subroutine
debug: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub stash { $Stash ||= {} } | ||||||||||||||||||||||||||
|
Subroutine
stash: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$Stash ||= {}
MC/DC0%0/1
$Stash ||= {}
$Stash
Truth table0%0/2
A
A= $Stash
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub clear_stash { $Stash = {} } | ||||||||||||||||||||||||||
|
Subroutine
clear_stash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub set_logfile { | ||||||||||||||||||||||||||
|
Subroutine
set_logfile: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 0 | my ($self, $file) = @_; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | if ( $file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 0 | eval { | |||||||||||||||||||||||||||
| 19 | 0 | require IO::File; | |||||||||||||||||||||||||||
| 20 | 0 | ▶ | $Log = IO::File->new( $file, 'w' ) or die "$file cannot open"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | $Log->autoflush; | |||||||||||||||||||||||||||
| 22 | }; | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | else { | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | $Log->close if $Log; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | undef $Log; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 3 | ▶ | sub log { | ||||||||||||||||||||||||||
|
Subroutine
log: called CC=3 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 3 | my ($self, @message) = @_; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 3 | ▶ | return unless $Debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | my ($package, $file, $line) = caller; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | print STDERR @message, "\n"; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if ( $Log ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | print $Log @message, " at line $line in $package\n"; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2 | ▶ | sub range { | ||||||||||||||||||||||||||
|
Subroutine
range: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 45 | 2 | my ($self, %options) = @_; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 2 | ▶ | my $from = $options{from} or die 'from is missing'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 2 | my $to = $options{to}; | |||||||||||||||||||||||||||
| 49 | 2 | my $length = $options{length}; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | ▶ | $to = $from + $length - 1 if !$to && $length; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $to and $length
MC/DC50%1/2
not $to and $length
not $to
$length
Truth table66%2/3
not(A) and B
A= not $toB= $length
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 2 | return ( $from .. $to ); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 7 | 1; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||