line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Duadua::Util; |
2
|
6
|
|
|
6
|
|
38
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
166
|
|
3
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2090
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub set_os { |
6
|
156
|
|
|
156
|
1
|
398
|
my ($class, $d, $h) = @_; |
7
|
|
|
|
|
|
|
|
8
|
156
|
100
|
66
|
|
|
318
|
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
|
|
|
|
|
76
|
$h->{is_windows} = 1; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Android') > -1 ) { |
12
|
29
|
|
|
|
|
59
|
$h->{is_android} = 1; |
13
|
29
|
|
|
|
|
68
|
$h->{is_linux} = 1; # Android is Linux also. |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
elsif ( index($d->ua, 'iPhone') > -1 ) { |
16
|
20
|
|
|
|
|
41
|
$h->{is_ios} = 1; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
elsif ( index($d->ua, 'iPad') > -1 || index($d->ua, 'iPod') > -1 ) { |
19
|
2
|
|
|
|
|
5
|
$h->{is_ios} = 1; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Macintosh') > -1 || index($d->ua, 'Mac OS') > -1 ) { |
22
|
2
|
|
|
|
|
5
|
$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
|
|
|
|
|
40
|
$h->{is_linux} = 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
156
|
|
|
|
|
686
|
return $h; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub ordering_match { |
35
|
47
|
|
|
47
|
1
|
129
|
my ($class, $d, $list) = @_; |
36
|
|
|
|
|
|
|
|
37
|
47
|
|
|
|
|
84
|
my $pre = 0; |
38
|
47
|
|
|
|
|
73
|
for my $word (@{$list}) { |
|
47
|
|
|
|
|
97
|
|
39
|
76
|
|
|
|
|
166
|
my $position = index($d->ua, $word); |
40
|
76
|
100
|
|
|
|
399
|
return 0 if $position < $pre; |
41
|
36
|
|
|
|
|
62
|
$pre = $position; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
30
|
return 1; # Match! |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |