line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Section::TestBase; |
2
|
11
|
|
|
11
|
|
22669
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
272
|
|
3
|
11
|
|
|
11
|
|
56
|
use warnings; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
263
|
|
4
|
11
|
|
|
11
|
|
53
|
use utf8; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
81
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
1102
|
use parent qw/Exporter/; |
|
11
|
|
|
|
|
327
|
|
|
11
|
|
|
|
|
139
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw/blocks/; |
8
|
11
|
|
|
11
|
|
6029
|
use Text::TestBase; |
|
11
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
1687
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
3
|
|
|
3
|
0
|
5
|
my $class = shift; |
14
|
3
|
50
|
|
|
|
15
|
my %args= @_==1 ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
15
|
3
|
|
|
|
|
13
|
bless { %args }, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub blocks(;$) { |
19
|
3
|
50
|
|
3
|
1
|
1203
|
my $self = ref $_[0] ? shift : __PACKAGE__->new(package => scalar caller); |
20
|
3
|
|
|
|
|
7
|
my $filter = shift; |
21
|
|
|
|
|
|
|
|
22
|
11
|
|
|
11
|
|
62
|
my $d = do { no strict 'refs'; \*{$self->{package}."::DATA"} }; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
1972
|
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
16
|
|
23
|
3
|
50
|
|
|
|
10
|
return unless defined fileno $d; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
17
|
seek $d, 0, 0; |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
4
|
my $line_offset = 0; |
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
|
|
131
|
my $content = join '', <$d>; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
28
|
my $parser = Text::TestBase->new(); |
32
|
3
|
|
|
|
|
11
|
my @blocks = $parser->parse($content); |
33
|
3
|
|
|
|
|
7
|
for my $block (@blocks) { |
34
|
9
|
|
|
|
|
15
|
$block->{_lineno} += $line_offset; |
35
|
|
|
|
|
|
|
} |
36
|
3
|
100
|
|
|
|
8
|
if($filter){ |
37
|
2
|
|
|
|
|
4
|
return grep {$_->has_section($filter)} @blocks; |
|
6
|
|
|
|
|
19
|
|
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
18
|
return @blocks; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |