line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::MobileCarrierJP::Softbank::Display; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
347
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
23
|
use charnames ':full'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
5
|
1
|
|
|
1
|
|
102
|
use List::Util qw/first/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
52
|
|
6
|
1
|
|
|
1
|
|
4
|
use WWW::MobileCarrierJP::Declare; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
parse_one( |
9
|
|
|
|
|
|
|
urls => ['http://creation.mb.softbank.jp/mc/terminal/terminal_info/terminal_display.html'], |
10
|
|
|
|
|
|
|
xpath => q(//div[@class='terminaltable']/table/tr[ not(@bgcolor="#cccccc") and count(child::td) != 1 and position() >= 3 ]), |
11
|
|
|
|
|
|
|
scraper => scraper { |
12
|
|
|
|
|
|
|
col 1 => 'model' => 'TEXT'; |
13
|
|
|
|
|
|
|
col 2 => 'browser_pixels' => [ 'TEXT', \&_parse_pixels_table ]; |
14
|
|
|
|
|
|
|
col 3 => 'browser_characters' => [ 'TEXT', \&_parse_characters_table ]; |
15
|
|
|
|
|
|
|
col 4 => 'appli_pixels' => [ 'TEXT', \&_parse_appli_pixels_table ]; |
16
|
|
|
|
|
|
|
col 5 => 'appli_fontsize' => [ 'TEXT', \&_parse_appli_pixels_table ]; |
17
|
|
|
|
|
|
|
col 6 => 'widget' => [ 'TEXT', \&_parse_pixels_table ]; |
18
|
|
|
|
|
|
|
col 7 => 'widget_homescreen' => [ 'TEXT', \&_parse_pixels_table ]; |
19
|
|
|
|
|
|
|
col 8 => 'flash' => [ |
20
|
|
|
|
|
|
|
'TEXT', |
21
|
|
|
|
|
|
|
sub { |
22
|
|
|
|
|
|
|
/(\d+)\s*x\s*(\d+)/ or return undef; |
23
|
|
|
|
|
|
|
+{ width => $1, height => $2 }; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
]; |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# [{orientation}]\nwidth x height |
30
|
|
|
|
|
|
|
sub _parse_pixels_table { |
31
|
0
|
|
|
0
|
|
|
my $text = shift; |
32
|
0
|
|
|
|
|
|
my @result; |
33
|
0
|
|
|
|
|
|
$text =~ s/\s//g; |
34
|
0
|
0
|
|
|
|
|
return if ($text eq "\N{MULTIPLICATION SIGN}"); |
35
|
0
|
|
|
|
|
|
while ( $text =~ s/\[([^\]])+\](\d+)x(\d+)// ) { |
36
|
0
|
|
|
|
|
|
push @result, |
37
|
|
|
|
|
|
|
{ |
38
|
|
|
|
|
|
|
orientation => $1, |
39
|
|
|
|
|
|
|
width => $2, |
40
|
|
|
|
|
|
|
height => $3, |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
\@result; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# [{orientation}]\n({size}:{width}x{height}\n)+ |
47
|
|
|
|
|
|
|
sub _parse_characters_table { |
48
|
0
|
|
|
0
|
|
|
my $text = shift; |
49
|
0
|
|
|
|
|
|
my @result; |
50
|
0
|
|
|
|
|
|
$text =~ s/\s//g; |
51
|
0
|
|
|
|
|
|
while ( $text =~ s/\[([^\]]+)\]((?:(?:[^:\[]+:)?\d+x\d+(?:\([^)]+\))?)+)// ) { |
52
|
0
|
|
|
|
|
|
my $mode = $1; |
53
|
0
|
|
|
|
|
|
my $table = $2; |
54
|
0
|
|
|
|
|
|
my @fontsize_table; |
55
|
0
|
|
|
|
|
|
while ( $table =~ s/(?:([^:]+):)?(\d+)x(\d+)(?:\(([^)]+)\))?// ) { |
56
|
0
|
|
|
|
|
|
push @fontsize_table, |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
size_label => $1, |
59
|
|
|
|
|
|
|
cols => $2, |
60
|
|
|
|
|
|
|
rows => $3, |
61
|
|
|
|
|
|
|
extra => $4, |
62
|
|
|
|
|
|
|
}; |
63
|
|
|
|
|
|
|
} |
64
|
0
|
|
|
|
|
|
push @result, |
65
|
|
|
|
|
|
|
{ |
66
|
|
|
|
|
|
|
orientation => $mode, |
67
|
|
|
|
|
|
|
size_table => \@fontsize_table, |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
} |
70
|
0
|
|
|
|
|
|
\@result; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# [{orientation}]\n({width}x{height}\n)+ |
74
|
|
|
|
|
|
|
sub _parse_appli_pixels_table { |
75
|
0
|
|
|
0
|
|
|
my $text = shift; |
76
|
0
|
|
|
|
|
|
my @result; |
77
|
0
|
|
|
|
|
|
$text =~ s/\s//g; |
78
|
0
|
|
|
|
|
|
while ( $text =~ s/\[([^\]]+)\]((?:[^\d\[]+\d+x\d+)+)// ) { |
79
|
0
|
|
|
|
|
|
my $mode = $1; |
80
|
0
|
|
|
|
|
|
my $table = $2; |
81
|
0
|
|
|
|
|
|
my @size_table; |
82
|
0
|
|
|
|
|
|
while ( $table =~ s/(\D+)(\d+)x(\d+)?// ) { |
83
|
0
|
|
|
|
|
|
push @size_table, |
84
|
|
|
|
|
|
|
{ |
85
|
|
|
|
|
|
|
resolution => $1, |
86
|
|
|
|
|
|
|
width => $2, |
87
|
|
|
|
|
|
|
height => $3, |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
} |
90
|
0
|
|
|
|
|
|
push @result, |
91
|
|
|
|
|
|
|
{ |
92
|
|
|
|
|
|
|
orientation => $mode, |
93
|
|
|
|
|
|
|
size_table => \@size_table, |
94
|
|
|
|
|
|
|
}; |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
|
\@result; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |