File Coverage

lib/PatchReader/PatchInfoGrabber.pm
Criterion Covered Total %
statement 28 28 100.0
branch 3 6 50.0
condition 1 3 33.3
subroutine 7 7 100.0
pod 0 5 0.0
total 39 49 79.5


line stmt bran cond sub pod time code
1             package PatchReader::PatchInfoGrabber;
2              
3 8     8   14105 use PatchReader::FilterPatch;
  8         20  
  8         203  
4              
5 8     8   44 use strict;
  8         13  
  8         2814  
6              
7             @PatchReader::PatchInfoGrabber::ISA = qw(PatchReader::FilterPatch);
8              
9             sub new {
10 8     8 0 607 my $class = shift;
11 8   33     137 $class = ref($class) || $class;
12 8         123 my $this = $class->SUPER::new();
13 8         22 bless $this, $class;
14              
15 8         32 return $this;
16             }
17              
18             sub patch_info {
19 7     7 0 5242 my $this = shift;
20 7         59 return $this->{PATCH_INFO};
21             }
22              
23             sub start_patch {
24 7     7 0 12 my $this = shift;
25 7         18 $this->{PATCH_INFO} = {};
26 7 50       42 $this->{TARGET}->start_patch(@_) if $this->{TARGET};
27             }
28              
29             sub start_file {
30 8     8 0 15 my $this = shift;
31 8         12 my ($file) = @_;
32 8         13 $this->{PATCH_INFO}{files}{$file->{filename}} = { %{$file} };
  8         67  
33 8         16 $this->{FILE} = { %{$file} };
  8         46  
34 8 50       51 $this->{TARGET}->start_file(@_) if $this->{TARGET};
35             }
36              
37             sub next_section {
38 8     8 0 23 my $this = shift;
39 8         14 my ($section) = @_;
40 8         37 $this->{PATCH_INFO}{files}{$this->{FILE}{filename}}{plus_lines} += $section->{plus_lines};
41 8         35 $this->{PATCH_INFO}{files}{$this->{FILE}{filename}}{minus_lines} += $section->{minus_lines};
42 8 50       51 $this->{TARGET}->next_section(@_) if $this->{TARGET};
43             }
44              
45             1