File Coverage

blib/lib/School/Code/Compare/Charset/NoComments/Hashy.pm
Criterion Covered Total %
statement 19 19 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 27 29 93.1


line stmt bran cond sub pod time code
1             package School::Code::Compare::Charset::NoComments::Hashy;
2             # ABSTRACT: trim comments
3             $School::Code::Compare::Charset::NoComments::Hashy::VERSION = '0.103'; # TRIAL
4 4     4   28 use strict;
  4         8  
  4         117  
5 4     4   19 use warnings;
  4         9  
  4         741  
6              
7             sub new {
8 11     11 0 24 my $class = shift;
9              
10 11         20 my $self = {
11             };
12 11         22 bless $self, $class;
13              
14 11         32 return $self;
15             }
16              
17             sub filter {
18 11     11 0 16 my $self = shift;
19 11         21 my $lines_ref = shift;
20              
21 11         15 my @no_comments;
22              
23 11         20 foreach my $row (@{$lines_ref}) {
  11         28  
24 177 100       367 next if ($row =~ /^#/);
25 168 100       334 $row = $1 if ($row =~ /(.*)#.*/);
26              
27 168         324 push @no_comments, $row;
28             }
29              
30 11         35 return \@no_comments;
31             }
32              
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             School::Code::Compare::Charset::NoComments::Hashy - trim comments
44              
45             =head1 VERSION
46              
47             version 0.103
48              
49             =head1 AUTHOR
50              
51             Boris Däppen <bdaeppen.perl@gmail.com>
52              
53             =head1 COPYRIGHT AND LICENSE
54              
55             This software is copyright (c) 2020 by Boris Däppen.
56              
57             This is free software; you can redistribute it and/or modify it under
58             the same terms as the Perl 5 programming language system itself.
59              
60             =cut