script/add_inet.pl untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 50 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2 use strict;
3 use warnings;
4 use utf8;
5 use Simple::IPInfo;
6 use SimpleR::Reshape;
7
8 use Getopt::Std;
9 my %opt;
10 getopt( 'fditsH', \%opt );
11
12 $opt{d} ||= "$opt{f}.csv";
13 $opt{i} //= 0;
14 $opt{s} //= ',';
15 $opt{H} //= 0;
16
17 read_table(
18 $opt{f},
19 conv_sub => sub {
20 my ($r) = @_;
21 my $ip = $r->[$opt{i}];
22 my ($inet) = ip_to_inet($ip);
23 push @$r, $inet;
24 return $r;
25 },
26 write_file => $opt{d},
27 sep => $opt{s},
28 charset => 'utf8',
29 return_arrayref => 0,
30 skip_head => $opt{H} ? 1 : 0,
31 );