lib/String/Trim/Regex.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 97.1% 34 / 35 CC 2 SCAR 2.5
CC
2
Cov
100%
trim
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package String::Trim::Regex;
2 1 our $VERSION = 20210604;
3  
4 1 ▶use warnings FATAL => qw(all);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =pod
9  
10 Trims the spaces off the leading / trailing string.
11 This is my first module. Be kind.
12  
13 =cut
14  
15 sub trim($)
16 3 ▶{
Subroutine trim: called CC=2 SCAR=6.9
Pod undocumented
17 3 my $string = shift;
18
19 3 ▶ unless (defined $string)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 1 2 3
20 {
21 1 confess qq[String needs to be defined.\n];
22 }
23
24 2 $string =~ s~^\s+|\s+$~~g;
25
26 2 $string
27 }
28  
29  
30 1 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 1 @ISA = qw(Exporter);
34 1 @EXPORT = qw();
35 1 @EXPORT_OK = qw(trim);
36
37 1 %EXPORT_TAGS = (all=>[@EXPORT, @EXPORT_OK]);
38  
39 1 1
40  
41 __END__
↑ Summary