File Coverage

blib/lib/WWW/MobileCarrierJP/Softbank/CIDR.pm
Criterion Covered Total %
statement 12 18 66.6
branch n/a
condition n/a
subroutine 4 7 57.1
pod 0 2 0.0
total 16 27 59.2


line stmt bran cond sub pod time code
1             package WWW::MobileCarrierJP::Softbank::CIDR;
2 1     1   315 use strict;
  1         1  
  1         21  
3 1     1   3 use warnings;
  1         1  
  1         20  
4 1     1   411 use Web::Scraper;
  1         59877  
  1         9  
5 1     1   480 use URI;
  1         3019  
  1         8  
6              
7 0     0 0   sub url { 'http://creation.mb.softbank.jp/mc/tech/tech_web/web_ipaddress.html'; }
8              
9             sub scrape {
10             scraper {
11             process q{//table[@class='onece_table' and position() <= 2]/tr},
12             'cidr[]', [
13             'TEXT',
14             sub {
15 0           s/\s//g
16             },
17             sub {
18 0           m{^([0-9.]+)(/[0-9]+)};
19 0           +{ ip => $1, subnetmask => $2 };
20             }
21 0     0     ];
22 0     0 0   }->scrape(URI->new(__PACKAGE__->url))->{cidr};
23             }
24              
25             1;
26             __END__