line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Metification;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
55670
|
use 5.006;
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
92
|
|
4
|
2
|
|
|
2
|
|
20
|
use strict;
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
74
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use vars qw /$VERSION/;
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
146
|
|
8
|
|
|
|
|
|
|
$VERSION = '1.01';
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
2353
|
use Filter::Simple;
|
|
2
|
|
|
|
|
78403
|
|
|
2
|
|
|
|
|
18
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Call the filter routine supplied by Filter::Simple.
|
13
|
|
|
|
|
|
|
# It is time to read the Filter::Simple man page now if you
|
14
|
|
|
|
|
|
|
# haven't done so yet.
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Then pray :) This is ugly.
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
FILTER_ONLY
|
19
|
|
|
|
|
|
|
all => \&_filter_all, # Used to get the source code lines
|
20
|
|
|
|
|
|
|
code => \&_filter_recurse, # Used to filter recursive replacements
|
21
|
|
|
|
|
|
|
# of limited depth
|
22
|
|
|
|
|
|
|
code => \&_filter_meta;#, # Used to filter replacements
|
23
|
|
|
|
|
|
|
# all => sub {my $co=0;my $c=$_;$c=~s/\n/$co++."\n"/sge;print $c;$_};
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my @src_lines;
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _filter_all {
|
28
|
2
|
50
|
|
2
|
|
805
|
if (@src_lines) {
|
29
|
0
|
|
|
|
|
0
|
die "Filter invoked multiple times. Not supported in this version!";
|
30
|
|
|
|
|
|
|
}
|
31
|
2
|
|
|
|
|
20
|
@src_lines = split /\n/;
|
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
8
|
$_;
|
34
|
|
|
|
|
|
|
};
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _filter_meta {
|
38
|
2
|
|
|
2
|
|
75568
|
while (
|
39
|
|
|
|
|
|
|
s{^\s*meta\s*(.*)}{
|
40
|
1
|
|
|
|
|
6
|
_replace_meta($1)
|
41
|
|
|
|
|
|
|
}mge
|
42
|
|
|
|
|
|
|
) {}
|
43
|
|
|
|
|
|
|
}
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _filter_recurse {
|
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
2
|
|
29568
|
while (
|
48
|
|
|
|
|
|
|
s{^\s*recursemeta\s*depth\s*\=\>\s*(\d+)\s*,\s*(.+)}!
|
49
|
10
|
|
|
|
|
25
|
my $depth = $1-1;
|
50
|
10
|
|
|
|
|
20
|
my $rep = _replace_meta($2);
|
51
|
10
|
100
|
|
|
|
23
|
if ($depth > 0) {
|
52
|
9
|
|
|
|
|
57
|
$rep =~ s{^\s*recursemeta\s*depth\s*\=\>\s*(\d+)\s*,\s*(.+)}|
|
53
|
9
|
|
|
|
|
33
|
"recursemeta depth => " . ($depth) . ", $2"
|
54
|
|
|
|
|
|
|
|mge;
|
55
|
1
|
|
|
|
|
7
|
} else { $rep =~ s{^\s*recursemeta\s*depth\s*\=\>\s*(\d+)\s*,\s*(.+)}||mg }
|
56
|
10
|
|
|
|
|
165
|
$rep;
|
57
|
|
|
|
|
|
|
!mge
|
58
|
|
|
|
|
|
|
) {}
|
59
|
|
|
|
|
|
|
}
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _replace_meta {
|
62
|
11
|
|
|
11
|
|
21
|
my $match = shift;
|
63
|
11
|
50
|
|
|
|
83
|
$match =~ /(\d+)\s*,\s*(\d+)/ or $match =~ /(\d+)/;
|
64
|
|
|
|
|
|
|
|
65
|
11
|
|
|
|
|
54
|
my ($start, $end) = ($1, $2);
|
66
|
|
|
|
|
|
|
|
67
|
11
|
50
|
|
|
|
26
|
return '' if not defined $start;
|
68
|
|
|
|
|
|
|
|
69
|
11
|
|
|
|
|
16
|
$start = int $start;
|
70
|
11
|
50
|
|
|
|
27
|
$start = @src_lines + $start if $start < 0;
|
71
|
11
|
50
|
|
|
|
26
|
$start = $#src_lines if $start > $#src_lines;
|
72
|
|
|
|
|
|
|
|
73
|
11
|
50
|
|
|
|
25
|
return $src_lines[$start] if not defined $end;
|
74
|
|
|
|
|
|
|
|
75
|
11
|
|
|
|
|
14
|
$end = int $end;
|
76
|
11
|
50
|
|
|
|
22
|
$end = @src_lines + $end if $end < 0;
|
77
|
11
|
50
|
|
|
|
25
|
$end = $#src_lines if $end > $#src_lines;
|
78
|
|
|
|
|
|
|
|
79
|
11
|
50
|
|
|
|
24
|
($start, $end) = ($end, $start) if $start > $end;
|
80
|
|
|
|
|
|
|
|
81
|
11
|
|
|
|
|
50
|
return join "\n", (@src_lines[($start .. $end)]);
|
82
|
|
|
|
|
|
|
}
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1;
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__
|