line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::ClearSilver::FunctionSet::string; |
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
10
|
use Text::ClearSilver::FunctionSet qw(usage); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
914
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub _function_sprintf { |
7
|
8
|
|
|
8
|
|
8611
|
my $fmt = shift; |
8
|
8
|
100
|
|
|
|
51
|
usage 'sprintf(fmt, ...)' if !defined $fmt; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
|
|
67
|
return sprintf($fmt, @_); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _function_substr { |
14
|
4
|
100
|
|
4
|
|
2183
|
if(@_ == 2) { |
|
|
50
|
|
|
|
|
|
15
|
2
|
|
|
|
|
20
|
return substr($_[0], $_[1]); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
elsif(@_ == 3) { |
18
|
2
|
|
|
|
|
19
|
return substr($_[0], $_[1], $_[2]); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else { |
21
|
0
|
|
|
|
|
0
|
usage 'substr(expr, offset [, length])'; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _function_trim { |
26
|
0
|
|
|
0
|
|
0
|
my($str) = @_; |
27
|
0
|
0
|
|
|
|
0
|
usage 'trim(expr)' if @_ != 1; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
$str =~ s/\A \s+ //xms; |
30
|
0
|
|
|
|
|
0
|
$str =~ s/ \s+ \z//xms; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
return $str; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _function_uc { |
36
|
2
|
50
|
|
2
|
|
1724
|
usage 'uc(expr)' if @_ != 1; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
20
|
return uc($_[0]); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _function_lc { |
42
|
2
|
50
|
|
2
|
|
185
|
usage 'lc(expr)' if @_ != 1; |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
30
|
return lc($_[0]); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _function_ucfirst { |
48
|
2
|
50
|
|
2
|
|
1042
|
usage 'ucfirst(expr)' if @_ != 1; |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
19
|
return ucfirst($_[0]); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _function_lcfirst { |
54
|
2
|
50
|
|
2
|
|
1169
|
usage 'lcfirst(expr)' if @_ != 1; |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
|
|
27
|
return lcfirst($_[0]); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |