line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Loop; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
4
|
3
|
|
|
3
|
|
99184
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
116
|
|
5
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
91
|
|
6
|
3
|
|
|
3
|
|
16
|
use Carp; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
3610
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
############################################################################## |
11
|
|
|
|
|
|
|
sub Array(\@&) |
12
|
|
|
|
|
|
|
############################################################################## |
13
|
|
|
|
|
|
|
{ |
14
|
5
|
|
|
5
|
1
|
3197
|
my $arrayref = shift(@_); |
15
|
5
|
|
|
|
|
9
|
my $callback = shift(@_); |
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
6
|
my $index; |
18
|
|
|
|
|
|
|
my @return; |
19
|
|
|
|
|
|
|
|
20
|
5
|
100
|
66
|
|
|
25
|
my $wantarray = (defined(wantarray()) and wantarray()) ? 1 : 0; |
21
|
|
|
|
|
|
|
#print "wantarray is $wantarray \n"; |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
14
|
ARRAY_LABEL:for(my $index=0; $index
|
24
|
|
|
|
|
|
|
{ |
25
|
25
|
|
|
|
|
26
|
my $control=undef; |
26
|
25
|
|
|
|
|
21
|
my @temp; |
27
|
25
|
100
|
|
|
|
43
|
if($wantarray) |
28
|
|
|
|
|
|
|
{ |
29
|
13
|
|
|
|
|
31
|
@temp = |
30
|
|
|
|
|
|
|
$callback->($index,$arrayref->[$index],$control); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else |
33
|
|
|
|
|
|
|
{ |
34
|
12
|
|
|
|
|
44
|
$callback->($index,$arrayref->[$index],$control); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
25
|
100
|
|
|
|
128
|
if(defined($control)) |
38
|
|
|
|
|
|
|
{ |
39
|
1
|
50
|
|
|
|
4
|
if($control eq 'last') |
|
|
0
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
41
|
1
|
|
|
|
|
3
|
last ARRAY_LABEL; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
elsif($control eq 'redo') |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
0
|
redo ARRAY_LABEL; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
0
|
croak "bad control value '$control'"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else |
53
|
|
|
|
|
|
|
{ |
54
|
24
|
|
|
|
|
75
|
push(@return,@temp); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
5
|
100
|
|
|
|
15
|
if($wantarray) |
59
|
3
|
|
|
|
|
21
|
{ return (@return); } |
|
2
|
|
|
|
|
6
|
|
60
|
|
|
|
|
|
|
else |
61
|
|
|
|
|
|
|
{return;} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
############################################################################## |
67
|
|
|
|
|
|
|
sub Hash(\%&) |
68
|
|
|
|
|
|
|
############################################################################## |
69
|
|
|
|
|
|
|
{ |
70
|
8
|
|
|
8
|
1
|
1080
|
my $hashref = shift(@_); |
71
|
8
|
|
|
|
|
12
|
my $callback = shift(@_); |
72
|
|
|
|
|
|
|
|
73
|
8
|
|
|
|
|
29
|
my $arrayref = [keys(%$hashref)]; |
74
|
8
|
|
|
|
|
15
|
my $index; |
75
|
|
|
|
|
|
|
my @return; |
76
|
|
|
|
|
|
|
|
77
|
8
|
100
|
66
|
|
|
28
|
my $wantarray = (defined(wantarray()) and wantarray()) ? 1 : 0; |
78
|
|
|
|
|
|
|
#print "wantarray is $wantarray \n"; |
79
|
|
|
|
|
|
|
|
80
|
8
|
|
|
|
|
19
|
HASH_LABEL:for(my $index=0; $index
|
81
|
|
|
|
|
|
|
{ |
82
|
48
|
|
|
|
|
53
|
my $control=undef; |
83
|
48
|
|
|
|
|
48
|
my @temp; |
84
|
48
|
100
|
|
|
|
68
|
if($wantarray) |
85
|
|
|
|
|
|
|
{ |
86
|
6
|
|
|
|
|
18
|
@temp = $callback-> |
87
|
|
|
|
|
|
|
( |
88
|
|
|
|
|
|
|
$arrayref->[$index], |
89
|
|
|
|
|
|
|
$hashref->{$arrayref->[$index]}, |
90
|
|
|
|
|
|
|
$index, |
91
|
|
|
|
|
|
|
$control |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else |
95
|
|
|
|
|
|
|
{ |
96
|
42
|
|
|
|
|
112
|
$callback-> |
97
|
|
|
|
|
|
|
( |
98
|
|
|
|
|
|
|
$arrayref->[$index], |
99
|
|
|
|
|
|
|
$hashref->{$arrayref->[$index]}, |
100
|
|
|
|
|
|
|
$index, |
101
|
|
|
|
|
|
|
$control |
102
|
|
|
|
|
|
|
); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
48
|
50
|
|
|
|
201
|
if(defined($control)) |
106
|
|
|
|
|
|
|
{ |
107
|
0
|
0
|
|
|
|
0
|
if($control eq 'last') |
|
|
0
|
|
|
|
|
|
108
|
|
|
|
|
|
|
{ |
109
|
0
|
|
|
|
|
0
|
last HASH_LABEL; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
elsif($control eq 'redo') |
112
|
|
|
|
|
|
|
{ |
113
|
0
|
|
|
|
|
0
|
redo HASH_LABEL; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
else |
116
|
|
|
|
|
|
|
{ |
117
|
0
|
|
|
|
|
0
|
croak "bad control value '$control'"; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
else |
121
|
|
|
|
|
|
|
{ |
122
|
48
|
|
|
|
|
122
|
push(@return,@temp); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
8
|
100
|
|
|
|
13
|
if($wantarray) |
127
|
1
|
|
|
|
|
13
|
{ return (@return); } |
|
7
|
|
|
|
|
22
|
|
128
|
|
|
|
|
|
|
else |
129
|
|
|
|
|
|
|
{return;} |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
############################################################################## |
135
|
|
|
|
|
|
|
sub File($&) |
136
|
|
|
|
|
|
|
############################################################################## |
137
|
|
|
|
|
|
|
{ |
138
|
2
|
|
|
2
|
1
|
1607
|
my $filename = shift(@_); |
139
|
2
|
|
|
|
|
4
|
my $callback = shift(@_); |
140
|
|
|
|
|
|
|
|
141
|
2
|
|
|
|
|
3
|
my @return; |
142
|
|
|
|
|
|
|
|
143
|
2
|
100
|
66
|
|
|
17
|
my $wantarray = (defined(wantarray()) and wantarray()) ? 1 : 0; |
144
|
|
|
|
|
|
|
#print "wantarray is $wantarray \n"; |
145
|
|
|
|
|
|
|
|
146
|
2
|
50
|
|
|
|
84
|
open ( my $filehandle, $filename ) or |
147
|
|
|
|
|
|
|
croak "Error: cannot open $filename"; |
148
|
|
|
|
|
|
|
|
149
|
2
|
|
|
|
|
4
|
my $linenumber=0; |
150
|
2
|
|
|
|
|
46
|
FILE_LABEL:while(<$filehandle>) |
151
|
|
|
|
|
|
|
{ |
152
|
15
|
|
|
|
|
16
|
$linenumber++; |
153
|
15
|
|
|
|
|
14
|
my $control=undef; |
154
|
15
|
|
|
|
|
15
|
my @temp; |
155
|
|
|
|
|
|
|
|
156
|
15
|
100
|
|
|
|
29
|
if($wantarray) |
157
|
|
|
|
|
|
|
{ |
158
|
12
|
|
|
|
|
25
|
@temp = $callback->($linenumber,$_, $control); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
else |
161
|
|
|
|
|
|
|
{ |
162
|
3
|
|
|
|
|
10
|
$callback->($linenumber,$_, $control); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
15
|
100
|
|
|
|
155
|
if(defined($control)) |
166
|
|
|
|
|
|
|
{ |
167
|
1
|
50
|
|
|
|
5
|
if($control eq 'last') |
|
|
0
|
|
|
|
|
|
168
|
|
|
|
|
|
|
{ |
169
|
1
|
|
|
|
|
3
|
last FILE_LABEL; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
elsif($control eq 'redo') |
172
|
|
|
|
|
|
|
{ |
173
|
0
|
|
|
|
|
0
|
redo FILE_LABEL; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
else |
176
|
|
|
|
|
|
|
{ |
177
|
0
|
|
|
|
|
0
|
croak "bad control value '$control'"; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
else |
181
|
|
|
|
|
|
|
{ |
182
|
14
|
|
|
|
|
44
|
push(@return,@temp); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
2
|
50
|
|
|
|
31
|
close($filehandle) or croak "Error: cannot close $filename"; |
187
|
2
|
100
|
|
|
|
6
|
if($wantarray) |
188
|
1
|
|
|
|
|
6
|
{ return (@return); } |
|
1
|
|
|
|
|
6
|
|
189
|
|
|
|
|
|
|
else |
190
|
|
|
|
|
|
|
{return;} |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
1; |
195
|
|
|
|
|
|
|
__END__ |