line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Nonogram::Base;
|
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
45
|
use strict;
|
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
203
|
|
4
|
6
|
|
|
6
|
|
34
|
use warnings;
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
3231
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my ($Conf, $Debug, $Stash, $Log);
|
7
|
|
|
|
|
|
|
|
8
|
0
|
0
|
|
0
|
1
|
0
|
sub conf { shift; @_ ? $Conf = shift : $Conf; }
|
|
0
|
|
|
|
|
0
|
|
9
|
3
|
50
|
|
3
|
1
|
5
|
sub debug { shift; @_ ? $Debug = shift : $Debug; }
|
|
3
|
|
|
|
|
18
|
|
10
|
0
|
|
0
|
0
|
1
|
0
|
sub stash { $Stash ||= {} }
|
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
1
|
0
|
sub clear_stash { $Stash = {} }
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub set_logfile {
|
15
|
0
|
|
|
0
|
1
|
0
|
my ($self, $file) = @_;
|
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
0
|
if ( $file ) {
|
18
|
0
|
|
|
|
|
0
|
eval {
|
19
|
0
|
|
|
|
|
0
|
require IO::File;
|
20
|
0
|
0
|
|
|
|
0
|
$Log = IO::File->new( $file, 'w' ) or die "$file cannot open";
|
21
|
0
|
|
|
|
|
0
|
$Log->autoflush;
|
22
|
|
|
|
|
|
|
};
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
else {
|
25
|
0
|
0
|
|
|
|
0
|
$Log->close if $Log;
|
26
|
0
|
|
|
|
|
0
|
undef $Log;
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub log {
|
31
|
3
|
|
|
3
|
1
|
154
|
my ($self, @message) = @_;
|
32
|
|
|
|
|
|
|
|
33
|
3
|
50
|
|
|
|
16
|
return unless $Debug;
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
my ($package, $file, $line) = caller;
|
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
print STDERR @message, "\n";
|
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
0
|
if ( $Log ) {
|
40
|
0
|
|
|
|
|
0
|
print $Log @message, " at line $line in $package\n";
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
}
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub range {
|
45
|
2
|
|
|
2
|
1
|
8
|
my ($self, %options) = @_;
|
46
|
|
|
|
|
|
|
|
47
|
2
|
50
|
|
|
|
10
|
my $from = $options{from} or die 'from is missing';
|
48
|
2
|
|
|
|
|
4
|
my $to = $options{to};
|
49
|
2
|
|
|
|
|
3
|
my $length = $options{length};
|
50
|
|
|
|
|
|
|
|
51
|
2
|
100
|
66
|
|
|
13
|
$to = $from + $length - 1 if !$to && $length;
|
52
|
|
|
|
|
|
|
|
53
|
2
|
|
|
|
|
12
|
return ( $from .. $to );
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1;
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__
|