File Coverage

blib/lib/Data/Section/Pluggable/Plugin/Trim.pm
Criterion Covered Total %
statement 35 35 100.0
branch 3 4 75.0
condition n/a
subroutine 10 10 100.0
pod 0 2 0.0
total 48 51 94.1


line stmt bran cond sub pod time code
1 3     3   23 use warnings;
  3         6  
  3         232  
2 3     3   61 use 5.020;
  3         11  
3 3     3   17 use true;
  3         13  
  3         57  
4 3     3   3767 use experimental qw( signatures );
  3         7  
  3         26  
5 3     3   641 use stable qw( postderef );
  3         7  
  3         46  
6              
7             package Data::Section::Pluggable::Plugin::Trim 0.08 {
8              
9             # ABSTRACT: Data::Section::Pluggable plugin that trims whitespace
10              
11              
12 3     3   403 use Class::Tiny qw( extensions );
  3         5  
  3         45  
13 3     3   2664 use Role::Tiny::With;
  3         24104  
  3         274  
14 3     3   25 use Ref::Util qw( is_arrayref );
  3         6  
  3         1035  
15              
16             with 'Data::Section::Pluggable::Role::ContentProcessorPlugin';
17              
18 4     4 0 340 sub BUILD ($self, $) {
  4         8  
  4         7  
19 4 100       158 if(defined $self->extensions) {
20 1 50       15 $self->extensions([$self-extensions]) unless is_arrayref $self->extensions;
21             } else {
22 3         141 $self->extensions(['txt']);
23             }
24             }
25              
26 5     5 0 9 sub process_content ($self, $dsp, $content) {
  5         22  
  5         8  
  5         7  
  5         8  
27 5         56 return $content =~ s/^\s*//r =~ s/\s*\z//r;
28             }
29             }
30              
31             __END__