1package WWW::MobileCarrierJP::Softbank::HTTPHeader; 2use strict; 3use warnings; 4use utf8; 5use WWW::MobileCarrierJP::Declare; 6 7my $url = 'http://creation.mb.softbank.jp/mc/terminal/terminal_info/terminal_httphedder.html'; 8 9parse_one( 10 urls => [$url], 11 xpath => '//div[@class="terminaltable"]/table/tr[position() > 3]/td[not(@colspan=8)]/..', 12 scraper => scraper { 13 process 'td:nth-child(1)', 'model', 'TEXT'; 14 15 process 'td:nth-child(2)', 'x-jphone-name', 'TEXT'; 16 process 'td:nth-child(3)', 'x-jphone-display', [ 'TEXT', \&_asterisk ]; 17 process 'td:nth-child(4)', 'x-jphone-color', 'TEXT'; 18 process 'td:nth-child(5)', 'x-jphone-smaf', [ 'TEXT', \&_undefine ]; 19 20 # maybe, no person needs x-s-* information. 21 # and, I don't want to maintenance this header related things :P 22 # process 'td:nth-child(6)', 'x-s-display-info', [ 'TEXT', \&_undefine, ]; 23 # process 'td:nth-child(7)', 'x-s-unique-id', [ 'TEXT', \&_undefine, ]; 24 }, 25); 26 27sub _asterisk { s/ x /*/ } 28 29sub _undefine { 30 my $x = shift; 31 $x =~ s/\s+$//; 32 $x =~ /^(?:−|-|\x{d7})$/ ? undef : $x; 33} 34 351; 36__END__ 37 38=encoding utf-8 39 40=head1 NAME 41 42WWW::MobileCarrierJP::Softbank::HTTPHeader - HTTPヘッダ(Softbank) 43 44=head1 SYNOPSIS 45 46 use WWW::MobileCarrierJP::Softbank::HTTPHeader; 47 WWW::MobileCarrierJP::Softbank::HTTPHeader->scrape(); 48 49=head1 AUTHOR 50 51Tokuhiro Matsuno < tokuhirom gmail com > 52 53=head1 SEE ALSO 54 55L<WWW::MobileCarrierJP> 56 57