File Coverage

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


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