File Coverage

blib/lib/Dist/Zilla/Plugin/Web/StripBOM.pm
Criterion Covered Total %
statement 17 18 94.4
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 24 27 88.8


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::Web::StripBOM;
2             $Dist::Zilla::Plugin::Web::StripBOM::VERSION = '0.0.7';
3             # ABSTRACT: Embedd module version to sources
4              
5 1     1   678700 use Moose;
  1         1  
  1         6  
6              
7 1     1   4263 use Path::Class;
  1         2  
  1         53  
8 1     1   4 use String::BOM qw(string_has_bom strip_bom_from_string);
  1         1  
  1         8  
9              
10             with 'Dist::Zilla::Role::FileMunger';
11             with 'Dist::Zilla::Plugin::Web::Role::FileMatcher';
12              
13             has 'file_match' => (
14             is => 'rw',
15              
16             default => sub { [ '.*' ] }
17             );
18              
19              
20              
21             sub munge_files {
22 1     1 0 73504 my ($self) = @_;
23            
24             $self->for_each_matched_file(sub {
25 3     3   2 my ($file) = @_;
26              
27 3         8 my $content = $file->content;
28            
29 3 50       1095 if (string_has_bom($content)) {
30 0           $file->content(strip_bom_from_string($content));
31             }
32 1         8 });
33             }
34              
35              
36 1     1   130 no Moose;
  1         1  
  1         5  
37             __PACKAGE__->meta->make_immutable();
38              
39              
40             1;
41              
42             __END__
43              
44             =pod
45              
46             =encoding UTF-8
47              
48             =head1 NAME
49              
50             Dist::Zilla::Plugin::Web::StripBOM - Embedd module version to sources
51              
52             =head1 VERSION
53              
54             version 0.0.7
55              
56             =head1 AUTHOR
57              
58             Nickolay Platonov <nplatonov@cpan.org>
59              
60             =head1 COPYRIGHT AND LICENSE
61              
62             This software is copyright (c) 2015 by Nickolay Platonov.
63              
64             This is free software; you can redistribute it and/or modify it under
65             the same terms as the Perl 5 programming language system itself.
66              
67             =cut