| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::Incorporated; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
168206
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
44
|
|
|
4
|
1
|
|
|
1
|
|
803
|
use IO::File; |
|
|
1
|
|
|
|
|
10022
|
|
|
|
1
|
|
|
|
|
141
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use File::Spec; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
28
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use vars '$VERSION'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
541
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '1.00'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
1
|
|
|
1
|
|
3680
|
unshift @INC, \&fine_products; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub fine_products |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
2
|
|
|
2
|
1
|
1034
|
my ($code, $module) = @_; |
|
18
|
2
|
|
|
|
|
7
|
(my $modfile = $module . '.pm') =~ s{::}{/}g; |
|
19
|
2
|
|
|
|
|
6
|
my $fh = bad_product()->( $module, $modfile ); |
|
20
|
|
|
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
6
|
return unless $fh; |
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
5
|
$INC{$modfile} = 1; |
|
24
|
2
|
|
|
|
|
7
|
$fh->seek( 0, 0 ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
710
|
return $fh; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub empty_box |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
2
|
|
|
2
|
1
|
7
|
my ($module, $modpath) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
8
|
return _fake_module_fh(<
|
|
34
|
|
|
|
|
|
|
package $module; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub DESTROY {} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub AUTOLOAD |
|
39
|
|
|
|
|
|
|
{ |
|
40
|
|
|
|
|
|
|
return 1; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
END_MODULE |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub breaks_when_needed |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
0
|
|
|
0
|
1
|
0
|
my ($module, $modfile) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
my $file; |
|
53
|
0
|
|
|
|
|
0
|
local @INC = @INC; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
for my $path (@INC) |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
0
|
|
|
|
|
0
|
local @ARGV = File::Spec->catfile( $path, $modfile ); |
|
58
|
0
|
0
|
|
|
|
0
|
next unless -e $ARGV[0]; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
0
|
$file = do { local $/; <> } or return; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
0
|
return unless $file; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
$file =~ s/(while\s*\()/$1 Acme::Incorporated::breaks() && /g; |
|
66
|
0
|
|
|
|
|
0
|
$file =~ s[(for[^;]+{)(\s*)] |
|
67
|
|
|
|
|
|
|
[$1$2last unless Acme::Incorporated::breaks();$2]xsg; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
0
|
return _fake_module_fh( $file ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub out_of_stock |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
0
|
|
|
0
|
1
|
0
|
my ($module, $modfile) = @_; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
return _fake_module_fh(<
|
|
77
|
|
|
|
|
|
|
print "$module is out of stock at the moment.\n" |
|
78
|
|
|
|
|
|
|
delete \$INC{$modfile}; |
|
79
|
|
|
|
|
|
|
END_MODULE |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _fake_module_fh |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
2
|
|
|
2
|
|
3
|
my $text = shift; |
|
86
|
2
|
50
|
|
|
|
394
|
my $fh = IO::File->new_tmpfile() or return; |
|
87
|
|
|
|
|
|
|
|
|
88
|
2
|
|
|
|
|
18
|
$fh->print( $text ); |
|
89
|
2
|
|
|
|
|
38
|
$fh->seek( 0, 0 ); |
|
90
|
|
|
|
|
|
|
|
|
91
|
2
|
|
|
|
|
81
|
return $fh; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub bad_product |
|
95
|
|
|
|
|
|
|
{ |
|
96
|
0
|
|
|
0
|
|
|
my $weight = rand(); |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
return \&empty_box if $weight <= 0.10; |
|
99
|
0
|
0
|
|
|
|
|
return \&breaks_when_needed if $weight <= 0.20; |
|
100
|
0
|
0
|
|
|
|
|
return \&out_of_stock if $weight <= 0.30; |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
|
|
return sub {}; |
|
|
0
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub breaks |
|
106
|
|
|
|
|
|
|
{ |
|
107
|
0
|
|
|
0
|
|
|
return rand() <= 0.10; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
|
111
|
|
|
|
|
|
|
__END__ |