blib/lib/Number/Object/Filter/Comma.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 13 | 13 | 100.0 |
branch | n/a | ||
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | 0 | 1 | 0.0 |
total | 17 | 18 | 94.4 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Number::Object::Filter::Comma; | ||||||
2 | |||||||
3 | 1 | 1 | 5 | use strict; | |||
1 | 1 | ||||||
1 | 32 | ||||||
4 | 1 | 1 | 4 | use warnings; | |||
1 | 1 | ||||||
1 | 26 | ||||||
5 | 1 | 1 | 4 | use base 'Number::Object::Filter'; | |||
1 | 2 | ||||||
1 | 8 | ||||||
6 | |||||||
7 | sub filter { | ||||||
8 | 9 | 9 | 0 | 15 | my($class, $c, $value) = @_; | ||
9 | 9 | 15 | local $_ = $value; | ||||
10 | 9 | 88 | 1 while s/((?:\A|[^.0-9])[-+]?\d+)(\d{3})/$1,$2/s; | ||||
11 | 9 | 39 | return $_; | ||||
12 | } | ||||||
13 | |||||||
14 | 1; |