File Coverage

blib/lib/DTL/Fast/Filter/Linenumbers.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 28 29 96.5


line stmt bran cond sub pod time code
1             package DTL::Fast::Filter::Linenumbers;
2 2     2   772 use strict; use utf8; use warnings FATAL => 'all';
  2     2   2  
  2     2   41  
  2         7  
  2         2  
  2         9  
  2         33  
  2         2  
  2         58  
3 2     2   6 use parent 'DTL::Fast::Filter';
  2         3  
  2         9  
4              
5             $DTL::Fast::FILTER_HANDLERS{'linenumbers'} = __PACKAGE__;
6              
7             #@Override
8             sub filter
9             {
10 1     1 0 1 shift; # self
11 1         1 shift; # filter_manager
12 1         1 my $value = shift; # value
13 1         1 shift; # context
14              
15            
16 1         1 my $counter = 1;
17             my $nextcounter = sub{
18 6     6   12 return $counter++.". ";
19 1         3 };
20              
21 1         4 $value =~ s/^/$nextcounter->()/gme;
  6         7  
22            
23 1         5 return $value;
24             }
25              
26             1;