line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Builder::Utils; |
2
|
6
|
|
|
6
|
|
3743
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
186
|
|
3
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
22
|
|
|
6
|
|
|
|
|
142
|
|
4
|
6
|
|
|
6
|
|
31
|
use Carp; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
1291
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# common utilities put here and not exported into Builder::* because it would pollute namespace (ie. tags!) |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub yank (&\@) { |
11
|
5
|
|
|
5
|
1
|
6
|
my ( $code, $array ) = @_; |
12
|
5
|
|
|
|
|
5
|
my $index = 0; |
13
|
5
|
|
|
|
|
7
|
my @return; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
5
|
while ( $index <= $#{ $array } ) { |
|
35
|
|
|
|
|
84
|
|
16
|
30
|
|
|
|
|
40
|
local $_ = $array->[ $index ]; |
17
|
30
|
100
|
|
|
|
88
|
if ( $code->() ) { |
18
|
8
|
|
|
|
|
18
|
push @return, splice @$array, $index, 1; |
19
|
|
|
|
|
|
|
} |
20
|
22
|
|
|
|
|
33
|
else { $index++ } |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
16
|
return @return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |