File Coverage

blib/lib/WWW/MobileCarrierJP/Softbank/HTTPHeader.pm
Criterion Covered Total %
statement 12 16 75.0
branch 0 2 0.0
condition n/a
subroutine 4 6 66.6
pod n/a
total 16 24 66.6


line stmt bran cond sub pod time code
1             package WWW::MobileCarrierJP::Softbank::HTTPHeader;
2 1     1   370 use strict;
  1         1  
  1         23  
3 1     1   3 use warnings;
  1         1  
  1         18  
4 1     1   3 use utf8;
  1         0  
  1         5  
5 1     1   14 use WWW::MobileCarrierJP::Declare;
  1         1  
  1         4  
6              
7             my $url = 'http://creation.mb.softbank.jp/mc/terminal/terminal_info/terminal_httphedder.html';
8              
9             parse_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              
27 0     0     sub _asterisk { s/ x /*/ }
28              
29             sub _undefine {
30 0     0     my $x = shift;
31 0           $x =~ s/\s+$//;
32 0 0         $x =~ /^(?:−|-|\x{d7})$/ ? undef : $x;
33             }
34              
35             1;
36             __END__