blib/lib/LeftPad.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 32 / 32 SCAR 6.9
CC
2
Cov
100%
leftpad
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
↑ Summary
1 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package LeftPad;
6 # ABSTRACT: Why should Node.js have all the fun?
7  
8 1 our $VERSION = '0.001';
9  
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 our @EXPORT = qw/leftpad/;
14  
15 #pod =func leftpad
16 #pod
17 #pod $string = leftpad( $string, $min_length );
18 #pod $string = leftpad( $string, $min_length, $pad_char );
19 #pod
20 #pod Returns a copy of the input string with left padding if the input string
21 #pod length is less than the minimum length. It pads with spaces unless given a
22 #pod pad character as a third argument.
23 #pod
24 #pod =cut
25  
26 sub leftpad {
27 1 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 9 ▶ return sprintf( "%*s", $_[1], $_[0] ) unless defined $_[2];
Subroutine leftpad: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[2] 6 3 9
29 3 return $_[2] x ( $_[1] - length( $_[0] ) ) . $_[0];
30 }
31  
32 1 1;
33  
34  
35 # vim: ts=4 sts=4 sw=4 et tw=75:
36  
37 __END__
↑ Summary