line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Clean::ToNonStringyNumber; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
723
|
use 5.010001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1142
|
use parent qw(Data::Clean::Base); |
|
1
|
|
|
|
|
339
|
|
|
1
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub command_replace_with_non_stringy_number { |
12
|
1
|
|
|
1
|
0
|
916
|
require Scalar::Util::LooksLikeNumber; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
532
|
my ($self, $args) = @_; |
15
|
1
|
|
|
|
|
4
|
return '{{var}} = Scalar::Util::LooksLikeNumber::looks_like_number({{var}}) =~ /\\A(?:1|5|9|13)\\z/ ? {{var}}+0 : {{var}}'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
1
|
3
|
my ($class, %opts) = @_; |
20
|
1
|
|
50
|
|
|
10
|
$opts{""} //= ['replace_with_non_stringy_number']; |
21
|
1
|
|
|
|
|
14
|
$class->SUPER::new(%opts); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get_cleanser { |
25
|
1
|
|
|
1
|
1
|
13
|
my $class = shift; |
26
|
1
|
|
|
|
|
5
|
state $singleton = $class->new; |
27
|
1
|
|
|
|
|
606
|
$singleton; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
# ABSTRACT: Convert stringy numbers in data to non-stringy numbers |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |