line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Rezrov::MethodMaker; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
320
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my %TOTALS; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
6
|
|
|
6
|
|
23
|
my ($package, @names) = @_; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
|
|
13
|
my $caller = scalar caller(); |
11
|
6
|
|
|
|
|
30
|
my $buffer = sprintf "\{ package %s;\n", $caller; |
12
|
6
|
|
|
|
|
13
|
my $type = 0; |
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
|
|
7
|
my $count = 0; |
15
|
6
|
100
|
|
|
|
22
|
if (ref $names[0]) { |
16
|
3
|
|
|
|
|
6
|
my $ref = shift @names; |
17
|
3
|
50
|
|
|
|
10
|
if (ref $ref eq "ARRAY") { |
18
|
3
|
|
|
|
|
4
|
$type = 1; |
19
|
3
|
|
50
|
|
|
23
|
$count = $ref->[0] || 0; |
20
|
|
|
|
|
|
|
# printf STDERR "%s sc: $count\n", scalar caller; |
21
|
|
|
|
|
|
|
} else { |
22
|
0
|
|
|
|
|
0
|
die "huh?"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
6
|
100
|
|
|
|
16
|
if ($type == 1) { |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# blessed array style |
29
|
|
|
|
|
|
|
# |
30
|
3
|
|
|
|
|
6
|
foreach (@names) { |
31
|
44
|
|
|
|
|
96
|
$buffer .= sprintf ' |
32
|
|
|
|
|
|
|
sub %s { |
33
|
|
|
|
|
|
|
return(defined $_[1] ? $_[0]->[%d] = $_[1] : $_[0]->[%d]); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
', $_, $count, $count; |
36
|
44
|
|
|
|
|
52
|
$count++; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} else { |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
# blessed hash style |
41
|
|
|
|
|
|
|
# |
42
|
3
|
|
|
|
|
7
|
foreach (@names) { |
43
|
18
|
|
|
|
|
49
|
$buffer .= sprintf ' |
44
|
|
|
|
|
|
|
sub %s { |
45
|
|
|
|
|
|
|
return(defined $_[1] ? $_[0]->{"%s"} = $_[1] : $_[0]->{"%s"}); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
', $_, $_, $_; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
6
|
|
|
|
|
14
|
$buffer .= "\n\}\n"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#print STDERR $buffer; |
53
|
6
|
100
|
|
191
|
0
|
3048
|
eval $buffer; |
|
191
|
100
|
|
207
|
0
|
1046
|
|
|
207
|
100
|
|
207
|
0
|
5801
|
|
|
207
|
100
|
|
5
|
0
|
915
|
|
|
5
|
50
|
|
4
|
0
|
32
|
|
|
4
|
100
|
|
3
|
0
|
25
|
|
|
3
|
100
|
|
13
|
0
|
39
|
|
|
13
|
100
|
|
2
|
0
|
2518
|
|
|
2
|
100
|
|
8
|
0
|
65
|
|
|
8
|
100
|
|
3
|
0
|
1824
|
|
|
3
|
100
|
|
16
|
0
|
35
|
|
|
16
|
100
|
|
2
|
0
|
93
|
|
|
2
|
100
|
|
3
|
0
|
58
|
|
|
3
|
100
|
|
3
|
0
|
37
|
|
|
3
|
100
|
|
5
|
0
|
71
|
|
|
5
|
100
|
|
1025
|
0
|
58
|
|
|
1025
|
100
|
|
2
|
0
|
77752
|
|
|
2
|
100
|
|
3
|
0
|
36
|
|
|
3
|
50
|
|
1
|
0
|
39
|
|
|
1
|
0
|
|
0
|
0
|
15
|
|
|
0
|
0
|
|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|
0
|
|
|
0
|
50
|
|
2
|
0
|
0
|
|
|
2
|
100
|
|
3
|
0
|
32
|
|
|
3
|
|
|
|
|
37
|
|
54
|
|
|
|
|
|
|
|
55
|
6
|
|
|
|
|
15
|
$TOTALS{$caller} = $count; |
56
|
|
|
|
|
|
|
|
57
|
6
|
50
|
|
|
|
1876
|
die "yikes: $buffer" if $@; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub get_count { |
61
|
|
|
|
|
|
|
# return count of methods built; for array style, returns next |
62
|
|
|
|
|
|
|
# available index |
63
|
0
|
|
|
0
|
0
|
|
return $TOTALS{scalar caller()}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |