line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eval::LineNumbers; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
139573
|
use warnings; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13
|
use Exporter 5.57 'import'; |
|
2
|
|
|
|
|
38
|
|
|
2
|
|
|
|
|
496
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw(eval_line_numbers eval_line_numbers_offset); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Add line numbers to heredoc blocks that contain perl source code |
10
|
|
|
|
|
|
|
our $VERSION = '0.35'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my %offset; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub eval_line_numbers_offset |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
1
|
83
|
my(undef, $file) = caller; |
17
|
1
|
|
|
|
|
4
|
$offset{$file} = shift; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub eval_line_numbers |
21
|
|
|
|
|
|
|
{ |
22
|
4
|
100
|
|
4
|
1
|
2722
|
my(undef, $file, $line) = caller( |
23
|
|
|
|
|
|
|
# Optional first arg is the caller level |
24
|
|
|
|
|
|
|
$_[0] =~ /^[0-9]+$/ ? (shift) : 0 |
25
|
|
|
|
|
|
|
); |
26
|
4
|
100
|
|
|
|
16
|
if(defined $offset{$file}) { |
27
|
2
|
|
|
|
|
5
|
$line += $offset{$file}; |
28
|
|
|
|
|
|
|
} else { |
29
|
2
|
|
|
|
|
4
|
$line++; |
30
|
|
|
|
|
|
|
} |
31
|
4
|
|
|
|
|
122
|
return join('', qq{#line $line "$file"\n}, @_) |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |