line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::UserAgentString::OS; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
HTTP::UserAgentString::OS - Operating system |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$os = $browser->os() |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
print "Name: ", $os->name(), "\n"; |
12
|
|
|
|
|
|
|
print "Family: ", $os->family(), "\n"; |
13
|
|
|
|
|
|
|
print "URL: ", $os->url(), "\n"; |
14
|
|
|
|
|
|
|
print "Company: ", $os->company(), "\n"; |
15
|
|
|
|
|
|
|
print "Company URL: ", $os->company_url(), "\n"; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Used to represent operating systems returned where browsers or |
20
|
|
|
|
|
|
|
robots run. The class is read only. Accesors are provided for |
21
|
|
|
|
|
|
|
all capabilities defined by user-agent-string.info |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=over 4 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item $os->name() |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
OS name (includes version). Example: Windows 95 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item $os->family() |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
OS family. I.e: Windows |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item $os->url() |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Web page for the OS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item $os->company() |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Name of the company that develops the OS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item $os->company_url() |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
URL of the company that develops the OS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item $os->ico() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Icon for the OS, found in http://user-agent-string.info/pub/img/os/ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=back |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 COPYRIGHT |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Copyright (c) 2011 Nicolas Moldavsky (http://www.e-planning.net/) |
56
|
|
|
|
|
|
|
This library is released under LGPL V3 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
141
|
|
61
|
4
|
|
|
4
|
|
21
|
use base qw(HTTP::UserAgentString::Sys); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1308
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my @KEYS = qw(family name url company company_url ico); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub new($$) { |
66
|
2
|
|
|
2
|
0
|
8
|
my ($pkg, $data) = @_; |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
6
|
my $h = {}; |
69
|
2
|
|
|
|
|
14
|
for (my $i = 0; $i < scalar(@KEYS); $i++) { |
70
|
12
|
|
|
|
|
20
|
my $val = $data->[$i]; |
71
|
12
|
100
|
66
|
|
|
57
|
if (defined($val) and (length($val) > 0)) { |
72
|
10
|
|
|
|
|
45
|
$h->{$KEYS[$i]} = $val; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
2
|
|
|
|
|
13
|
return bless($h, $pkg); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
1
|
1
|
9
|
sub family($) { $_[0]->{family} } |
79
|
0
|
|
|
0
|
1
|
|
sub ico($) { $_[0]->{ico} } |
80
|
0
|
|
|
0
|
1
|
|
sub name($) { $_[0]->{name} } |
81
|
0
|
|
|
0
|
1
|
|
sub company($) { $_[0]->{company} } |
82
|
0
|
|
|
0
|
1
|
|
sub company_url($) { $_[0]->{company_url} } |
83
|
0
|
|
|
0
|
1
|
|
sub url($) { $_[0]->{url} } |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |