File Coverage

blib/lib/Banal/Utils/String.pm
Criterion Covered Total %
statement 15 25 60.0
branch n/a
condition n/a
subroutine 5 8 62.5
pod 3 3 100.0
total 23 36 63.8


line stmt bran cond sub pod time code
1             #===============================================
2             package Banal::Utils::String;
3              
4 1     1   8005 use 5.006;
  1         5  
  1         47  
5 1     1   6 use utf8;
  1         2  
  1         9  
6 1     1   25 use strict;
  1         2  
  1         38  
7 1     1   6 use warnings;
  1         3  
  1         38  
8 1     1   6 no warnings qw(uninitialized);
  1         11  
  1         10155  
9              
10             require Exporter;
11              
12             our @ISA = qw(Exporter);
13             our @EXPORT_OK = qw(trim ltrim rtrim);
14              
15             # Perl trim function to remove whitespace from the start and end of the string
16             sub trim($)
17             {
18 0     0 1   my $string = shift;
19 0           $string =~ s/^\s+//;
20 0           $string =~ s/\s+$//;
21 0           return $string;
22             }
23             # Left trim function to remove leading whitespace
24             sub ltrim($)
25             {
26 0     0 1   my $string = shift;
27 0           $string =~ s/^\s+//;
28 0           return $string;
29             }
30             # Right trim function to remove trailing whitespace
31             sub rtrim($)
32             {
33 0     0 1   my $string = shift;
34 0           $string =~ s/\s+$//;
35 0           return $string;
36             }
37              
38             1;
39              
40             __END__