line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Lingua::EN::Numbers; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
136442
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
250
|
|
4
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
254
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
29
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
393
|
|
7
|
|
|
|
|
|
|
$VERSION = 0.02; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
29
|
use base qw(Template::Plugin); |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
3564
|
|
10
|
6
|
|
|
6
|
|
27730
|
use Template::Plugin; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
130
|
|
11
|
6
|
|
|
6
|
|
3090
|
use Template::Stash; |
|
6
|
|
|
|
|
86523
|
|
|
6
|
|
|
|
|
199
|
|
12
|
6
|
|
|
6
|
|
3503
|
use Lingua::EN::Numbers qw( num2en num2en_ordinal ); |
|
6
|
|
|
|
|
9952
|
|
|
6
|
|
|
|
|
470
|
|
13
|
6
|
|
|
6
|
|
2887
|
use Lingua::EN::Numbers::Years qw( year2en ); |
|
6
|
|
|
|
|
19515
|
|
|
6
|
|
|
|
|
469
|
|
14
|
6
|
|
|
6
|
|
3284
|
use Lingua::EN::Numbers::Ordinate qw( ordinate ); |
|
6
|
|
|
|
|
2074
|
|
|
6
|
|
|
|
|
2062
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'num2en'} = \&_num2en; |
17
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'num2en_ordinal'} = \&_num2en_ordinal; |
18
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'year2en'} = \&_year2en; |
19
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'ordinate'} = \&_ordinate; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
8
|
|
|
8
|
1
|
17310
|
my ($class, $context, $options) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# now define the filter and return the plugin |
25
|
8
|
|
|
|
|
22
|
$context->define_filter('num2en', \&_num2en); |
26
|
8
|
|
|
|
|
109
|
$context->define_filter('num2en_ordinal', \&_num2en_ordinal); |
27
|
8
|
|
|
|
|
78
|
$context->define_filter('year2en', \&_year2en); |
28
|
8
|
|
|
|
|
75
|
$context->define_filter('ordinate', \&_ordinate); |
29
|
8
|
|
|
|
|
84
|
return bless {}, $class; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _num2en { |
33
|
3
|
50
|
|
3
|
|
167
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
34
|
3
|
|
|
|
|
9
|
return num2en(join('', @_)); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _num2en_ordinal { |
38
|
3
|
50
|
|
3
|
|
148
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
39
|
3
|
|
|
|
|
10
|
return num2en_ordinal(join('', @_)); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _year2en { |
43
|
3
|
50
|
|
3
|
|
143
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
44
|
3
|
|
|
|
|
11
|
return year2en(join('', @_)); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _ordinate { |
48
|
3
|
50
|
|
3
|
|
111
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
49
|
3
|
|
|
|
|
10
|
return ordinate(join('', @_)); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |