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