line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Sandbox::StringFunctions; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
17209
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
165
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
642
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
32
|
use base 'Template::Sandbox::Library'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1640
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
26
|
use Template::Sandbox qw/:function_sugar/; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1971
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$Template::Sandbox::StringFunctions::VERSION = '1.04'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->set_library_functions( |
13
|
|
|
|
|
|
|
lc => ( one_arg sub { lc( $_[ 0 ] ) } ), |
14
|
|
|
|
|
|
|
lcfirst => ( one_arg |
15
|
|
|
|
|
|
|
sub { ref( $_[ 0 ] ) ? |
16
|
|
|
|
|
|
|
[ map { lcfirst( $_ ) } @{$_[ 0 ]} ] : lcfirst( $_[ 0 ] ) } ), |
17
|
|
|
|
|
|
|
uc => ( one_arg sub { uc( $_[ 0 ] ) } ), |
18
|
|
|
|
|
|
|
ucfirst => ( one_arg |
19
|
|
|
|
|
|
|
sub { ref( $_[ 0 ] ) ? |
20
|
|
|
|
|
|
|
[ map { ucfirst( $_ ) } @{$_[ 0 ]} ] : ucfirst( $_[ 0 ] ) } ), |
21
|
|
|
|
|
|
|
substr => ( three_args sub { substr( $_[ 0 ], $_[ 1 ], $_[ 2 ] ) } ), |
22
|
|
|
|
|
|
|
length => ( one_arg sub { length( $_[ 0 ] ) } ), |
23
|
|
|
|
|
|
|
possessive => |
24
|
|
|
|
|
|
|
( one_arg sub { $_[ 0 ] . ( $_[ 0 ] =~ /s$/ ? "'" : "'s" ) } ), |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |