File Coverage

blib/lib/School/Code/Compare/Charset/NoComments/XMLy.pm
Criterion Covered Total %
statement 6 21 28.5
branch 0 6 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 33 24.2


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