line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Template::Compiled::Plugin::Sprintf; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Use sprintf in HTML::Template::Compiled templates |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
4252
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
120
|
|
6
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
102
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
37
|
use HTML::Template::Compiled; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
25
|
|
9
|
|
|
|
|
|
|
HTML::Template::Compiled->register(__PACKAGE__); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub register{ |
14
|
3
|
|
|
3
|
0
|
44
|
my ($class) = @_; |
15
|
3
|
|
|
|
|
22
|
my %plugs = ( |
16
|
|
|
|
|
|
|
escape => { |
17
|
|
|
|
|
|
|
SPRINTF_30_LEFT => \&escape_sprintf_30_left, |
18
|
|
|
|
|
|
|
SPRINTF_6_RIGHT => \&escape_sprintf_6_right, |
19
|
|
|
|
|
|
|
SPRINTF_8_RIGHT => \&escape_sprintf_8_right, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
14
|
return \%plugs; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub escape_sprintf_30_left { |
27
|
1
|
|
|
1
|
0
|
2285
|
my ($escaped) = @_; |
28
|
1
|
50
|
|
|
|
6
|
return unless defined $escaped; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
5
|
my $string = sprintf "%-30s", $escaped; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
29
|
return $string; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub escape_sprintf_6_right { |
36
|
1
|
|
|
1
|
0
|
1827
|
my ($escaped) = @_; |
37
|
1
|
50
|
|
|
|
4
|
return unless defined $escaped; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
4
|
my $string = sprintf "%6s", $escaped; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
22
|
return $string; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub escape_sprintf_8_right { |
45
|
1
|
|
|
1
|
0
|
2191
|
my ($escaped) = @_; |
46
|
1
|
50
|
|
|
|
5
|
return unless defined $escaped; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
my $string = sprintf "%8s", $escaped; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
29
|
return $string; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |