| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTTP::UserAgentString::Robot; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
HTTP::UserAgentString::Robot - Web robot |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$robot = $p->parse($string) |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
print "This is a ", ($robot->isRobot()) ? "robot" : "browser", "\n"; |
|
12
|
|
|
|
|
|
|
print "Family: ", $robot->family(), "\n"; |
|
13
|
|
|
|
|
|
|
print "Name: ", $robot->name(), "\n"; |
|
14
|
|
|
|
|
|
|
print "URL: ", $robot->url(), "\n"; |
|
15
|
|
|
|
|
|
|
print "Company: ", $robot->company(), "\n"; |
|
16
|
|
|
|
|
|
|
print "Company URL: ", $robot->company_url(), "\n"; |
|
17
|
|
|
|
|
|
|
print "Info URL: ", $robot->info_url(), "\n"; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$os = $robot->os(); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Used to represent web robots returned by L. Object is read |
|
24
|
|
|
|
|
|
|
only. Accesors are provided for all capabilities defined by |
|
25
|
|
|
|
|
|
|
user-agent-string.info |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 4 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item $robot->family() |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Robot family. I.e, name without version. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item $robot->name() |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Robot name including version |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item $robot->url() |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Web page for the robot |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item $robot->company() |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Name of the company that develops the robot |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item $robot->company_url() |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
URL of the company that develops the robot |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item $robot->ico() |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
PNG icon for the robot that can be obtained from http://user-agent-string.info/pub/img/ua/ |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item $robot->info_url() |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Web page in http://user-agent-string.info/ that provides information on the robot |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item $robot->os |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
If defined, L object representing the operating system where the robot is |
|
62
|
|
|
|
|
|
|
running. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L for the class representing operating systems, and L |
|
69
|
|
|
|
|
|
|
for browsers. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Copyright (c) 2011 Nicolas Moldavsky (http://www.e-planning.net/) |
|
74
|
|
|
|
|
|
|
This library is released under LGPL V3 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
4
|
|
|
4
|
|
19
|
use strict; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
139
|
|
|
79
|
4
|
|
|
4
|
|
18
|
use base qw(HTTP::UserAgentString::Sys); |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
1398
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my @KEYS = qw(uastring family name url company company_url ico os_id info_url); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub new($$;$) { |
|
84
|
5620
|
|
|
5620
|
0
|
8021
|
my ($pkg, $data, $os) = @_; |
|
85
|
|
|
|
|
|
|
|
|
86
|
5620
|
|
|
|
|
9037
|
my $h = {}; |
|
87
|
5620
|
|
|
|
|
13239
|
for (my $i = 0; $i < scalar(@KEYS); $i++) { |
|
88
|
50580
|
|
|
|
|
72350
|
my $val = $data->[$i]; |
|
89
|
50580
|
100
|
66
|
|
|
198629
|
if (defined($val) and (length($val) > 0)) { |
|
90
|
43320
|
|
|
|
|
158442
|
$h->{$KEYS[$i]} = $val; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
} |
|
93
|
5620
|
|
|
|
|
9970
|
$h->{os} = $os; |
|
94
|
5620
|
|
|
|
|
22083
|
return bless($h, $pkg); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
|
|
0
|
0
|
0
|
sub uastring($) { $_[0]->{uastring} } |
|
99
|
3
|
|
|
3
|
1
|
16
|
sub family($) { $_[0]->{family} } |
|
100
|
0
|
|
|
0
|
1
|
0
|
sub info_url($) { $_[0]->{info_url} } |
|
101
|
3
|
|
|
3
|
1
|
14
|
sub os($) { $_[0]->{os} } |
|
102
|
0
|
|
|
0
|
0
|
0
|
sub os_id($) { $_[0]->{os_id} } |
|
103
|
|
|
|
|
|
|
|
|
104
|
3
|
|
|
3
|
0
|
12
|
sub isRobot($) { 1 } |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |