line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Clean::ToStringyNumber; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
670
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
964
|
use parent qw(Data::Clean::Base); |
|
1
|
|
|
|
|
293
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub command_replace_with_stringy_number { |
12
|
1
|
|
|
1
|
0
|
985
|
require Scalar::Util::LooksLikeNumber; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
573
|
my ($self, $args) = @_; |
15
|
1
|
|
|
|
|
4
|
return '{{var}} = defined({{var}}) && Scalar::Util::LooksLikeNumber::looks_like_number({{var}}) > 36 ? "{{var}}" : {{var}}'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
1
|
4
|
my ($class, %opts) = @_; |
20
|
1
|
|
50
|
|
|
9
|
$opts{""} //= ['replace_with_stringy_number']; |
21
|
1
|
|
|
|
|
14
|
$class->SUPER::new(%opts); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get_cleanser { |
25
|
1
|
|
|
1
|
1
|
12
|
my $class = shift; |
26
|
1
|
|
|
|
|
6
|
state $singleton = $class->new; |
27
|
1
|
|
|
|
|
690
|
$singleton; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
# ABSTRACT: Convert non-stringy numbers in data to stringy numbers |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |