line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package coroutine0; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20666
|
use 5.000; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
91
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
132
|
|
5
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION @ISA %bodystrings); |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
134
|
|
6
|
|
|
|
|
|
|
@ISA = qw(); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#my %bodystrings; |
11
|
|
|
|
|
|
|
my $labname = 'corolab'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
104
|
|
|
1
|
|
|
|
|
3846
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub rewrite($){ |
16
|
3
|
|
|
3
|
0
|
7
|
my $l = $labname++; |
17
|
3
|
|
|
|
|
20
|
<
|
18
|
|
|
|
|
|
|
\$LABEL='$l'; |
19
|
|
|
|
|
|
|
return $_[0]; |
20
|
|
|
|
|
|
|
$l: |
21
|
|
|
|
|
|
|
EOF |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new{ |
25
|
1
|
|
|
1
|
0
|
98
|
shift; # shift off the package name |
26
|
1
|
|
|
|
|
6
|
my %args = @_; |
27
|
|
|
|
|
|
|
#print stderr @_; |
28
|
1
|
50
|
|
|
|
6
|
my $body = |
29
|
|
|
|
|
|
|
$args{BODY} or croak "Need a BODY argument"; |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
|
|
|
2
|
my @vars = @{$args{VARS}||[]}; |
|
1
|
|
|
|
|
5
|
|
32
|
1
|
|
|
|
|
3
|
unshift @vars, '$LABEL'; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
4
|
my $varlist = join ";\nmy ",@vars; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
9
|
$body =~ s/\bYIELD\b(.*?);/rewrite $1/seg; |
|
3
|
|
|
|
|
7
|
|
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
3
|
my $callingpackage = caller; |
39
|
1
|
|
|
|
|
7
|
$body = <
|
40
|
|
|
|
|
|
|
package $callingpackage; |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
my $varlist; |
43
|
|
|
|
|
|
|
\$LABEL = 'START'; |
44
|
|
|
|
|
|
|
sub $args{PROTO} { |
45
|
|
|
|
|
|
|
$args{PRE} |
46
|
|
|
|
|
|
|
goto \$LABEL; |
47
|
|
|
|
|
|
|
START: |
48
|
|
|
|
|
|
|
$body |
49
|
|
|
|
|
|
|
\$LABEL = 'START'; |
50
|
|
|
|
|
|
|
undef; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
EOF |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
3
|
my $coderef; |
56
|
|
|
|
|
|
|
# print stderr "BODY:\n$body\nEND_BODY\n"; |
57
|
1
|
50
|
|
|
|
4
|
$args{DIE} and croak "BODY:\n$body\nEND_BODY\n"; |
58
|
1
|
|
|
|
|
3
|
eval { $coderef = eval $body }; |
|
1
|
|
|
|
|
248
|
|
59
|
1
|
50
|
|
|
|
5
|
$@ and croak $@; |
60
|
|
|
|
|
|
|
|
61
|
1
|
50
|
|
|
|
5
|
ref($coderef) or croak <
|
62
|
|
|
|
|
|
|
Failed to get coderef from evaluating: |
63
|
|
|
|
|
|
|
$body |
64
|
|
|
|
|
|
|
END_OF_BODY |
65
|
|
|
|
|
|
|
EOF |
66
|
|
|
|
|
|
|
|
67
|
1
|
50
|
|
|
|
5
|
return $coderef if $args{TIDY}; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
1
|
bless $coderef; |
70
|
1
|
|
|
|
|
7
|
$bodystrings{$coderef} = \$body; |
71
|
1
|
|
|
|
|
6
|
return $coderef; |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub copy{ |
75
|
|
|
|
|
|
|
|
76
|
3
|
|
|
3
|
0
|
141
|
my $cr2; |
77
|
3
|
|
|
|
|
5
|
my $coderef = shift; |
78
|
3
|
|
|
|
|
4
|
eval { $cr2 = eval |
|
3
|
|
|
|
|
585
|
|
79
|
3
|
|
|
7
|
|
4
|
${$bodystrings{$coderef}} |
|
7
|
|
|
|
|
93
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
}; |
81
|
3
|
50
|
|
|
|
11
|
$@ and croak $@; |
82
|
|
|
|
|
|
|
|
83
|
3
|
|
|
|
|
5
|
bless $cr2; |
84
|
3
|
|
|
|
|
12
|
$bodystrings{$cr2} = $bodystrings{$coderef} ; |
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
11
|
return $cr2; |
87
|
|
|
|
|
|
|
}; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub DESTROY{ |
90
|
0
|
|
|
0
|
|
|
delete $bodystrings{$_[0]}; |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
__END__ |