File Coverage

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


line stmt bran cond sub pod time code
1 1     1   20472 use 5.10.1;
  1         3  
2 1     1   5 use strict;
  1         2  
  1         23  
3 1     1   5 use warnings;
  1         2  
  1         56  
4             package String::Stomp;
5              
6             our $VERSION = '0.0102'; # VERSION
7             # ABSTRACT: Removes empty leading and trailing lines
8              
9 1     1   5 use Exporter 'import';
  1         2  
  1         163  
10             our @EXPORT = qw/stomp/;
11              
12             sub stomp($) {
13 7     7 1 35 my $string = shift;
14              
15 7         33 $string =~ s{\A[\h\v]*\v(?=\h*[^\h\v])}{};
16 7         62 $string =~ s{([^\h\v]\V*)\v[\h\v]*\z}{$1};
17              
18 7         33 return $string;
19             }
20              
21             1;
22              
23             __END__