File Coverage

blib/lib/String/Stomp.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1 1     1   15899 use 5.10.1;
  1         3  
  1         37  
2 1     1   4 use strict;
  1         2  
  1         38  
3 1     1   3 use warnings;
  1         1  
  1         64  
4             package String::Stomp;
5              
6             our $VERSION = '0.0101'; # VERSION
7             # ABSTRACT: Removes empty leading and trailing lines
8              
9 1         11 use Sub::Exporter::Progressive -setup => {
10             exports => [qw/stomp/],
11             groups => {
12             default => [qw/stomp/],
13             },
14 1     1   446 };
  1         875  
15              
16             sub stomp($) {
17 7     7 1 31 my $string = shift;
18              
19 7         31 $string =~ s{\A[\h\v]*\v(?=\h*[^\h\v])}{};
20 7         43 $string =~ s{([^\h\v]\V*)\v[\h\v]*\z}{$1};
21              
22 7         27 return $string;
23             }
24              
25             1;
26              
27             __END__