line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Template::Compiled::Plugin::Comma; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: Comma.pm 3 2007-07-08 07:06:51Z hagy $ |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
115210
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
159
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
HTML::Template::Compiled->register(__PACKAGE__); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub register { |
12
|
1
|
|
|
1
|
0
|
37
|
my ($class) = @_; |
13
|
1
|
|
|
|
|
5
|
my %plugs = ( |
14
|
|
|
|
|
|
|
escape => { |
15
|
|
|
|
|
|
|
COMMA => \&commify, |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
); |
18
|
1
|
|
|
|
|
3
|
return \%plugs; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub commify { |
22
|
3
|
|
|
3
|
0
|
3703
|
local $_ = shift; |
23
|
3
|
|
|
|
|
72
|
1 while s/((?:\A|[^.0-9])[-+]?\d+)(\d{3})/$1,$2/s; |
24
|
3
|
|
|
|
|
73
|
return $_; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |