line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Duadua::Util; |
2
|
6
|
|
|
6
|
|
34
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
171
|
|
3
|
6
|
|
|
6
|
|
26
|
use warnings; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
2135
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub set_os { |
6
|
156
|
|
|
156
|
1
|
387
|
my ($class, $d, $h) = @_; |
7
|
|
|
|
|
|
|
|
8
|
156
|
100
|
66
|
|
|
331
|
if ( index($d->ua, 'Win') > -1 && (index($d->ua, 'Win32') > -1 || index($d->ua, 'Windows') > -1) ) { |
|
|
100
|
66
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
9
|
33
|
|
|
|
|
81
|
$h->{is_windows} = 1; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Android') > -1 ) { |
12
|
29
|
|
|
|
|
75
|
$h->{is_android} = 1; |
13
|
29
|
|
|
|
|
71
|
$h->{is_linux} = 1; # Android is Linux also. |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
elsif ( index($d->ua, 'iPhone') > -1 ) { |
16
|
20
|
|
|
|
|
73
|
$h->{is_ios} = 1; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
elsif ( index($d->ua, 'iPad') > -1 || index($d->ua, 'iPod') > -1 ) { |
19
|
2
|
|
|
|
|
7
|
$h->{is_ios} = 1; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Macintosh') > -1 || index($d->ua, 'Mac OS') > -1 ) { |
22
|
2
|
|
|
|
|
8
|
$h->{is_ios} = 1; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
elsif ( index($d->ua, ' CrOS ') > -1 ) { |
25
|
2
|
|
|
|
|
5
|
$h->{is_chromeos} = 1; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Linux') > -1 ) { |
28
|
14
|
|
|
|
|
35
|
$h->{is_linux} = 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
156
|
|
|
|
|
628
|
return $h; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub ordering_match { |
35
|
47
|
|
|
47
|
1
|
116
|
my ($class, $d, $list) = @_; |
36
|
|
|
|
|
|
|
|
37
|
47
|
|
|
|
|
80
|
my $pre = 0; |
38
|
47
|
|
|
|
|
62
|
for my $word (@{$list}) { |
|
47
|
|
|
|
|
156
|
|
39
|
76
|
|
|
|
|
165
|
my $position = index($d->ua, $word); |
40
|
76
|
100
|
|
|
|
339
|
return 0 if $position < $pre; |
41
|
36
|
|
|
|
|
58
|
$pre = $position; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
34
|
return 1; # Match! |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |