script/add_ip_info.pl untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 59 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
7 use Getopt::Std;
8 my %opt;
9 getopt( 'fditsH', \%opt );
10
11 $opt{d} ||= "$opt{f}.csv";
12 $opt{i} ||= 0;
13 $opt{s} ||= ',';
14 $opt{H} ||= 0;
15 $opt{type} = ($opt{t} and $opt{t} eq 'as') ? $Simple::IPInfo::IPINFO_AS_F : $Simple::IPInfo::IPINFO_LOC_F;
16 $opt{names} = ($opt{t} and $opt{t} eq 'as') ? [ 'as' ] : [ qw/country area isp country_code area_code isp_code/ ];
17
18 iterate_ipinfo(
19 $opt{f}, #inet-sorted file
20 i => $opt{i},
21 write_file => $opt{d},
22 sep => $opt{s},
23 charset => 'utf8',
24 return_arrayref => 0,
25 ipinfo_file => $opt{type},
26 ipinfo_names => $opt{names},
27 skip_head => $opt{H} ? 1 : 0,
28 );