line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::HTTP::UserAgent; |
2
|
|
|
|
|
|
|
$Template::Plugin::HTTP::UserAgent::VERSION = '0.07'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Template plugin for parsing HTTP User-Agent string |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
308228
|
use 5.006; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
90
|
|
6
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
7
|
2
|
|
|
2
|
|
24
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
156
|
|
8
|
2
|
|
|
2
|
|
2017
|
use parent 'Template::Plugin'; |
|
2
|
|
|
|
|
639
|
|
|
2
|
|
|
|
|
12
|
|
9
|
2
|
|
|
2
|
|
4964
|
use HTML::ParseBrowser; |
|
2
|
|
|
|
|
6104
|
|
|
2
|
|
|
|
|
623
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
2
|
|
|
2
|
1
|
92
|
my $class = shift; |
14
|
2
|
|
|
|
|
5
|
my $context = shift; |
15
|
2
|
|
|
|
|
4
|
my $ua; |
16
|
|
|
|
|
|
|
|
17
|
2
|
50
|
66
|
|
|
21
|
if (@_ == 0 && !exists($ENV{HTTP_USER_AGENT})) { |
18
|
0
|
|
|
|
|
0
|
return $class->error('No User-Agent string given'); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
2
|
100
|
|
|
|
18
|
$ua = HTML::ParseBrowser->new(@_ > 0 ? shift : $ENV{HTTP_USER_AGENT}); |
22
|
|
|
|
|
|
|
|
23
|
2
|
50
|
|
|
|
691
|
if (!defined($ua)) { |
24
|
0
|
|
|
|
|
0
|
return $class->error("Failed to instantiate HTML::ParseBrowser"); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
bless { |
28
|
2
|
|
|
|
|
15
|
UA => $ua, |
29
|
|
|
|
|
|
|
}, $class; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
2
|
1
|
137
|
sub name { return $_[0]->{UA}->name; } |
33
|
2
|
|
|
2
|
1
|
82
|
sub version { return $_[0]->{UA}->v; } |
34
|
2
|
|
|
2
|
1
|
78
|
sub major { return $_[0]->{UA}->major; } |
35
|
2
|
|
|
2
|
1
|
78
|
sub minor { return $_[0]->{UA}->minor; } |
36
|
2
|
|
|
2
|
1
|
76
|
sub os { return $_[0]->{UA}->os; } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |