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   1164 use strict; use utf8; use warnings FATAL => 'all';
  2     2   3  
  2     2   45  
  2         10  
  2         4  
  2         12  
  2         47  
  2         4  
  2         69  
3 2     2   10 use parent 'DTL::Fast::Filter';
  2         4  
  2         11  
4              
5             $DTL::Fast::FILTER_HANDLERS{'linenumbers'} = __PACKAGE__;
6              
7             #@Override
8             sub filter
9             {
10 1     1 0 6 shift; # self
11 1         2 shift; # filter_manager
12 1         1 my $value = shift; # value
13 1         2 shift; # context
14              
15            
16 1         1 my $counter = 1;
17             my $nextcounter = sub{
18 6     6   22 return $counter++.". ";
19 1         4 };
20              
21 1         5 $value =~ s/^/$nextcounter->()/gme;
  6         9  
22            
23 1         7 return $value;
24             }
25              
26             1;