File Coverage

lib/PatchReader/NarrowPatch.pm
Criterion Covered Total %
statement 12 26 46.1
branch 0 12 0.0
condition 1 3 33.3
subroutine 3 6 50.0
pod 0 4 0.0
total 16 51 31.3


line stmt bran cond sub pod time code
1             package PatchReader::NarrowPatch;
2              
3 1     1   844 use PatchReader::FilterPatch;
  1         2  
  1         19  
4              
5 1     1   4 use strict;
  1         1  
  1         275  
6              
7             @PatchReader::NarrowPatch::ISA = qw(PatchReader::FilterPatch);
8              
9             sub new {
10 1     1 0 428 my $class = shift;
11 1   33     7 $class = ref($class) || $class;
12 1         8 my $this = $class->SUPER::new();
13 1         2 bless $this, $class;
14              
15 1         8 $this->{INCLUDE_FILES} = [@_];
16              
17 1         3 return $this;
18             }
19              
20             sub start_file {
21 0     0 0   my $this = shift;
22 0           my ($file) = @_;
23 0 0         if (grep { $_ eq substr($file->{filename}, 0, length($_)) } @{$this->{INCLUDE_FILES}}) {
  0            
  0            
24 0           $this->{IS_INCLUDED} = 1;
25 0 0         $this->{TARGET}->start_file(@_) if $this->{TARGET};
26             }
27             }
28              
29             sub end_file {
30 0     0 0   my $this = shift;
31 0 0         if ($this->{IS_INCLUDED}) {
32 0 0         $this->{TARGET}->end_file(@_) if $this->{TARGET};
33 0           $this->{IS_INCLUDED} = 0;
34             }
35             }
36              
37             sub next_section {
38 0     0 0   my $this = shift;
39 0 0         if ($this->{IS_INCLUDED}) {
40 0 0         $this->{TARGET}->next_section(@_) if $this->{TARGET};
41             }
42             }
43              
44             1