line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::MobileAgent::Plugin::SmartPhone; |
2
|
3
|
|
|
3
|
|
51587
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
98
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
89
|
|
4
|
3
|
|
|
3
|
|
3103
|
use utf8; |
|
3
|
|
|
|
|
34
|
|
|
3
|
|
|
|
|
16
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_smartphone { |
8
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
9
|
0
|
0
|
|
|
|
0
|
$self->is_ios || $self->is_android; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_ios { |
13
|
18
|
|
|
18
|
0
|
775
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
18
|
|
50
|
|
|
45
|
my $ua = $self->user_agent || ''; |
16
|
18
|
|
|
|
|
260
|
$ua =~ /\(iP(?:hone|od|ad)/; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_iphone { |
20
|
6
|
|
|
6
|
0
|
34
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
50
|
|
|
13
|
my $ua = $self->user_agent || ''; |
23
|
6
|
|
|
|
|
73
|
$ua =~ /\(iPhone/; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_ipad { |
27
|
6
|
|
|
6
|
0
|
41
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
6
|
|
50
|
|
|
18
|
my $ua = $self->user_agent || ''; |
30
|
6
|
|
|
|
|
85
|
$ua =~ /\(iPad/; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_ipod { |
34
|
6
|
|
|
6
|
0
|
36
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
6
|
|
50
|
|
|
16
|
my $ua = $self->user_agent || ''; |
37
|
6
|
|
|
|
|
79
|
$ua =~ /\(iPod/; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_android { |
41
|
12
|
|
|
12
|
0
|
498
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
12
|
|
50
|
|
|
24
|
my $ua = $self->user_agent || ''; |
44
|
12
|
|
|
|
|
138
|
$ua =~ /Android/; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_android_tablet { |
48
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
49
|
0
|
0
|
|
|
|
0
|
$self->is_android && $self->user_agent !~ /Mobile/ |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub HTTP::MobileAgent::ios_full_version { |
53
|
12
|
|
|
12
|
0
|
39
|
my $self = shift; |
54
|
12
|
100
|
|
|
|
22
|
return () unless $self->is_ios; |
55
|
|
|
|
|
|
|
|
56
|
10
|
|
|
|
|
23
|
local $1; |
57
|
10
|
|
|
|
|
10
|
my $full_version; |
58
|
10
|
50
|
|
|
|
32
|
if ($self->user_agent =~ /CPU (?:iPhone )?(?:OS ((?:\d+)(?:_\d+)*) )?like/) { |
59
|
10
|
|
100
|
|
|
160
|
$full_version = $1 || 1; |
60
|
|
|
|
|
|
|
} |
61
|
10
|
|
|
|
|
41
|
$full_version; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub HTTP::MobileAgent::ios_version { |
65
|
6
|
|
100
|
6
|
0
|
49
|
my ($version) = (shift->ios_full_version || '') =~ /^(\d+)/; |
66
|
6
|
|
|
|
|
11
|
$version; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub HTTP::MobileAgent::is_tablet { |
70
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
71
|
0
|
0
|
|
|
|
0
|
$self->is_ipad || $self->is_android_tablet; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub HTTP::MobileAgent::android_full_version { |
75
|
8
|
|
|
8
|
0
|
23
|
my $self = shift; |
76
|
8
|
50
|
|
|
|
13
|
return () unless $self->is_android; |
77
|
|
|
|
|
|
|
|
78
|
8
|
|
|
|
|
19
|
my ($full_version) = $self->user_agent =~ /Android\s*([0-9\.]+).*?;/; |
79
|
8
|
|
|
|
|
102
|
$full_version; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub HTTP::MobileAgent::android_version { |
83
|
4
|
|
50
|
4
|
0
|
35
|
my ($version) = (shift->android_full_version || '') =~ /^((?:\d+)(?:\.\d+)?)/; |
84
|
4
|
|
|
|
|
7
|
$version; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
__END__ |