line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Filter::NumberLines;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
661
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
4
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
300
|
|
5
|
1
|
|
|
1
|
|
995
|
use Filter::Util::Call ;
|
|
1
|
|
|
|
|
1133
|
|
|
1
|
|
|
|
|
685
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.02';
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $line = 0;
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import {
|
12
|
1
|
|
|
1
|
|
8
|
my ($type) = shift @_;
|
13
|
1
|
|
|
|
|
3
|
my ($ref) = [] ;
|
14
|
1
|
|
|
|
|
4
|
filter_add(bless $ref) ;
|
15
|
|
|
|
|
|
|
}
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub filter {
|
18
|
10
|
|
|
10
|
0
|
32
|
my ($self) = @_ ;
|
19
|
10
|
|
|
|
|
10
|
my ($status) ;
|
20
|
10
|
100
|
|
|
|
38
|
if (($status = filter_read()) > 0)
|
21
|
9
|
|
|
|
|
29
|
{ s/^\d+\:\t//; }
|
22
|
10
|
|
|
|
|
1630
|
$status ;
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
open(F,"<$0") || die $!;
|
26
|
|
|
|
|
|
|
open(OUTFILE,">$0.bak") || die $!;
|
27
|
|
|
|
|
|
|
$line = 0;
|
28
|
|
|
|
|
|
|
my $no_go = 0;
|
29
|
|
|
|
|
|
|
my $past_use = 0;
|
30
|
|
|
|
|
|
|
$|++;
|
31
|
|
|
|
|
|
|
while()
|
32
|
|
|
|
|
|
|
{ $line++;
|
33
|
|
|
|
|
|
|
if ($past_use && /^\d+\:\t/) { $no_go++;last; }
|
34
|
|
|
|
|
|
|
if ($past_use)
|
35
|
|
|
|
|
|
|
{ $_ = sprintf ("%03d",$line).":\t".$_; }
|
36
|
|
|
|
|
|
|
if (/use Filter\:\:NumberLines;/)
|
37
|
|
|
|
|
|
|
{ $past_use++; }
|
38
|
|
|
|
|
|
|
print OUTFILE $_;
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
close(OUTFILE);
|
41
|
|
|
|
|
|
|
if (!$no_go)
|
42
|
|
|
|
|
|
|
{ unlink($0) || die $!;
|
43
|
|
|
|
|
|
|
rename ("$0.bak",$0);
|
44
|
|
|
|
|
|
|
close(F);
|
45
|
|
|
|
|
|
|
exit;
|
46
|
|
|
|
|
|
|
} else { unlink("$0.bak") || die $!; }
|
47
|
|
|
|
|
|
|
1;
|
48
|
|
|
|
|
|
|
__END__
|