line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Duadua::Util; |
2
|
6
|
|
|
6
|
|
39
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
170
|
|
3
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
2283
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub set_os { |
6
|
157
|
|
|
157
|
1
|
450
|
my ($class, $d, $h) = @_; |
7
|
|
|
|
|
|
|
|
8
|
157
|
100
|
66
|
|
|
338
|
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
|
|
|
|
|
71
|
$h->{is_windows} = 1; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Android') > -1 ) { |
12
|
30
|
|
|
|
|
69
|
$h->{is_android} = 1; |
13
|
30
|
|
|
|
|
64
|
$h->{is_linux} = 1; # Android is Linux also. |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
elsif ( index($d->ua, 'iPhone') > -1 ) { |
16
|
20
|
|
|
|
|
53
|
$h->{is_ios} = 1; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
elsif ( index($d->ua, 'iPad') > -1 || index($d->ua, 'iPod') > -1 ) { |
19
|
2
|
|
|
|
|
4
|
$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
|
|
|
|
|
7
|
$h->{is_chromeos} = 1; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Linux') > -1 ) { |
28
|
14
|
|
|
|
|
42
|
$h->{is_linux} = 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
157
|
|
|
|
|
678
|
return $h; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub ordering_match { |
35
|
48
|
|
|
48
|
1
|
117
|
my ($class, $d, $list) = @_; |
36
|
|
|
|
|
|
|
|
37
|
48
|
|
|
|
|
79
|
my $pre = 0; |
38
|
48
|
|
|
|
|
85
|
for my $word (@{$list}) { |
|
48
|
|
|
|
|
123
|
|
39
|
78
|
|
|
|
|
141
|
my $position = index($d->ua, $word); |
40
|
78
|
100
|
|
|
|
381
|
return 0 if $position < $pre; |
41
|
37
|
|
|
|
|
83
|
$pre = $position; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
31
|
return 1; # Match! |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |