| 1 | package DTL::Fast::Filter::Numberformat; | ||||||||||
| 2 | 2 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use parent 'DTL::Fast::Filter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 2 | $DTL::Fast::FILTER_HANDLERS{'numberformat'} = __PACKAGE__; | |||||||||
| 6 | |||||||||||
| 7 | #@Override | ||||||||||
| 8 | sub filter | ||||||||||
| 9 | { | ||||||||||
| 10 | 16 | ▶ | my( $self, $filter_manager, $value, $context) = @_; | ||||||||
|
Subroutine
filter: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 11 | |||||||||||
| 12 | 16 | ▶ | die $self->get_render_error($context, 'unable to numberformat undef value') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | if not defined $value; | ||||||||||
| 14 | |||||||||||
| 15 | 16 | my @num = split /\./, $value; | |||||||||
| 16 | 16 | $num[0] =~ s/ | |||||||||
| 17 | (\d)(?= | ||||||||||
| 18 | (\d{3})+(?!\d) | ||||||||||
| 19 | ) | ||||||||||
| 20 | /$1 /gsx; | ||||||||||
| 21 | |||||||||||
| 22 | 16 | return join '.', @num; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 2 | 1; | |||||||||