| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Text::Annotated::Line; |
|
2
|
|
|
|
|
|
|
# $Id: Line.pm,v 1.6 2007-05-12 18:39:16 wim Exp $ |
|
3
|
2
|
|
|
2
|
|
599
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
71
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use vars qw($VERSION); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
81
|
|
|
5
|
2
|
|
|
2
|
|
1529
|
use fields qw(filename linenr content); |
|
|
2
|
|
|
|
|
3011
|
|
|
|
2
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
|
|
use overload ( |
|
7
|
2
|
|
|
|
|
21
|
"\"\"" => \&stringify |
|
8
|
2
|
|
|
2
|
|
222
|
); |
|
|
2
|
|
|
|
|
3
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.04'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
1
|
|
|
1
|
1
|
82
|
my $proto = shift; |
|
13
|
1
|
|
33
|
|
|
6
|
my $pkg = ref($proto) || $proto; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# build the object |
|
16
|
2
|
|
|
2
|
|
188
|
no strict 'refs'; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
499
|
|
|
17
|
1
|
|
|
|
|
1
|
my $this = bless [\%{"${pkg}::FIELDS"}], $pkg; |
|
|
1
|
|
|
|
|
6
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# initialize any specified fields |
|
20
|
1
|
|
|
|
|
4
|
my %arg = @_; |
|
21
|
1
|
|
|
|
|
5
|
while(my($k,$v) = each %arg) { |
|
22
|
1
|
|
|
|
|
134
|
$this->{$k} = $v; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return $this; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub clone { # returns a deep copy |
|
29
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
|
30
|
0
|
|
|
|
|
|
return $this->new( |
|
31
|
|
|
|
|
|
|
filename => $this->{filename}, |
|
32
|
|
|
|
|
|
|
linenr => $this->{linenr}, |
|
33
|
|
|
|
|
|
|
content => $this->{content}, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub stringify { |
|
38
|
0
|
|
|
0
|
1
|
|
my Text::Annotated::Line $this = shift; |
|
39
|
0
|
|
|
|
|
|
$this->{content}; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub stringify_annotated { |
|
43
|
0
|
|
|
0
|
1
|
|
my Text::Annotated::Line $this = shift; |
|
44
|
0
|
|
|
|
|
|
my $file = $this->{filename}; |
|
45
|
0
|
|
|
|
|
|
my $linenr = sprintf('%05d',$this->{linenr}); |
|
46
|
0
|
|
|
|
|
|
my $content = $this->{content}; |
|
47
|
0
|
|
|
|
|
|
chomp $content; |
|
48
|
0
|
|
|
|
|
|
return "[$file\#$linenr]$content"; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |