line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
13038
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package LeftPad; |
6
|
|
|
|
|
|
|
# ABSTRACT: Why should Node.js have all the fun? |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
3
|
use base 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
91
|
|
13
|
|
|
|
|
|
|
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 Zero or negative minimum length returns the input string. Only the first |
25
|
|
|
|
|
|
|
#pod character in the pad-character string is used. Undefined warnings are |
26
|
|
|
|
|
|
|
#pod suppressed so an undefined input string is treated as an empty string. |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod =cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub leftpad { |
31
|
1
|
|
|
1
|
|
3
|
no warnings 'uninitialized'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
90
|
|
32
|
13
|
100
|
|
13
|
1
|
86
|
return "" . $_[0] if $_[1] < 1; |
33
|
10
|
100
|
100
|
|
|
59
|
return sprintf( "%*s", $_[1], $_[0] ) unless defined $_[2] && length $_[2]; |
34
|
4
|
|
|
|
|
18
|
return substr( $_[2], 0, 1 ) x ( $_[1] - length $_[0] ) . $_[0]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et tw=75: |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |