line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Lingua::EN::Numbers; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
215888
|
use strict; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
223
|
|
4
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
263
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
38
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
372
|
|
7
|
|
|
|
|
|
|
$VERSION = 0.01; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
33
|
use base qw(Template::Plugin); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
328745
|
|
10
|
6
|
|
|
6
|
|
245431
|
use Template::Plugin; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
152
|
|
11
|
6
|
|
|
6
|
|
7944
|
use Template::Stash; |
|
6
|
|
|
|
|
141797
|
|
|
6
|
|
|
|
|
243
|
|
12
|
6
|
|
|
6
|
|
7335
|
use Lingua::EN::Numbers qw( num2en num2en_ordinal ); |
|
6
|
|
|
|
|
15821
|
|
|
6
|
|
|
|
|
738
|
|
13
|
6
|
|
|
6
|
|
7319
|
use Lingua::EN::Numbers::Years qw( year2en ); |
|
6
|
|
|
|
|
32900
|
|
|
6
|
|
|
|
|
719
|
|
14
|
6
|
|
|
6
|
|
7401
|
use Lingua::EN::Numbers::Ordinate qw( ordinate ); |
|
6
|
|
|
|
|
3409
|
|
|
6
|
|
|
|
|
2720
|
|
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
|
44697
|
my ($class, $context, $options) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# now define the filter and return the plugin |
25
|
8
|
|
|
|
|
45
|
$context->define_filter('num2en', \&_num2en); |
26
|
8
|
|
|
|
|
259
|
$context->define_filter('num2en_ordinal', \&_num2en_ordinal); |
27
|
8
|
|
|
|
|
194
|
$context->define_filter('year2en', \&_year2en); |
28
|
8
|
|
|
|
|
125
|
$context->define_filter('ordinate', \&_ordinate); |
29
|
8
|
|
|
|
|
137
|
return bless {}, $class; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _num2en { |
33
|
3
|
50
|
|
3
|
|
278
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
34
|
3
|
|
|
|
|
16
|
return num2en(join('', @_)); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _num2en_ordinal { |
38
|
3
|
50
|
|
3
|
|
215
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
39
|
3
|
|
|
|
|
121
|
return num2en_ordinal(join('', @_)); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _year2en { |
43
|
3
|
50
|
|
3
|
|
279
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
44
|
3
|
|
|
|
|
19
|
return year2en(join('', @_)); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _ordinate { |
48
|
3
|
50
|
|
3
|
|
166
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
49
|
3
|
|
|
|
|
16
|
return ordinate(join('', @_)); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |