line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::HTTP::UserAgent::Base::Accessors; |
2
|
|
|
|
|
|
|
$Parse::HTTP::UserAgent::Base::Accessors::VERSION = '0.42'; |
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
5
|
2
|
|
|
2
|
|
10
|
use Parse::HTTP::UserAgent::Constants qw(:all); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
480
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
2
|
|
|
2
|
|
14
|
my @simple = qw( |
9
|
|
|
|
|
|
|
device |
10
|
|
|
|
|
|
|
generic |
11
|
|
|
|
|
|
|
lang |
12
|
|
|
|
|
|
|
mobile |
13
|
|
|
|
|
|
|
name |
14
|
|
|
|
|
|
|
original_name |
15
|
|
|
|
|
|
|
original_version |
16
|
|
|
|
|
|
|
os |
17
|
|
|
|
|
|
|
parser |
18
|
|
|
|
|
|
|
robot |
19
|
|
|
|
|
|
|
strength |
20
|
|
|
|
|
|
|
tablet |
21
|
|
|
|
|
|
|
touch |
22
|
|
|
|
|
|
|
unknown |
23
|
|
|
|
|
|
|
wap |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
5
|
my @multi = qw( |
27
|
|
|
|
|
|
|
mozilla |
28
|
|
|
|
|
|
|
extras |
29
|
|
|
|
|
|
|
dotnet |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
2
|
|
12
|
no strict qw(refs); ## no critic (TestingAndDebugging::ProhibitNoStrict) |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
325
|
|
33
|
2
|
|
|
|
|
5
|
foreach my $name ( @simple ) { |
34
|
30
|
|
|
|
|
64
|
my $id = 'UA_' . uc $name; |
35
|
30
|
|
|
|
|
140
|
$id = __PACKAGE__->$id(); |
36
|
30
|
|
100
|
2597
|
|
93
|
*{ $name } = sub { return shift->[$id] || q{} }; |
|
30
|
|
|
|
|
105
|
|
|
2597
|
|
|
|
|
90451
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
6
|
foreach my $name ( @multi ) { |
40
|
6
|
|
|
|
|
11
|
my $id = 'UA_' . uc $name; |
41
|
6
|
|
|
|
|
25
|
$id = __PACKAGE__->$id(); |
42
|
6
|
|
|
|
|
215
|
*{ $name } = sub { |
43
|
646
|
|
|
646
|
|
1447
|
my $self = shift; |
44
|
646
|
100
|
|
|
|
1522
|
return +() if ! $self->[ $id ]; |
45
|
286
|
|
|
|
|
386
|
my @rv = @{ $self->[ $id ] }; |
|
286
|
|
|
|
|
599
|
|
46
|
286
|
50
|
|
|
|
859
|
return wantarray ? @rv : $rv[0]; |
47
|
6
|
|
|
|
|
18
|
}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub version { |
52
|
562
|
|
|
562
|
1
|
954
|
my $self = shift; |
53
|
562
|
|
100
|
|
|
1543
|
my $type = shift || q{}; |
54
|
562
|
|
100
|
|
|
2672
|
return $self->[ $type eq 'raw' ? UA_VERSION_RAW : UA_VERSION ] || 0; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub toolkit { |
58
|
281
|
|
|
281
|
1
|
772
|
my $self = shift; |
59
|
281
|
|
|
|
|
637
|
return Parse::HTTP::UserAgent::Base::Accessors::toolkit->new( |
60
|
|
|
|
|
|
|
$self->[UA_TOOLKIT] |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
package |
65
|
|
|
|
|
|
|
Parse::HTTP::UserAgent::Base::Accessors::toolkit; |
66
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
40
|
|
67
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
63
|
|
68
|
2
|
|
|
|
|
16
|
use overload '""', => 'name', |
69
|
|
|
|
|
|
|
'0+', => 'version', |
70
|
|
|
|
|
|
|
fallback => 1, |
71
|
2
|
|
|
2
|
|
9
|
; |
|
2
|
|
|
|
|
3
|
|
72
|
2
|
|
|
2
|
|
168
|
use constant ID_NAME => 0; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
128
|
|
73
|
2
|
|
|
2
|
|
10
|
use constant ID_VERSION_RAW => 1; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
74
|
2
|
|
|
2
|
|
10
|
use constant ID_VERSION => 2; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
297
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub new { |
77
|
281
|
|
|
281
|
|
508
|
my($class, $tk) = @_; |
78
|
281
|
100
|
|
|
|
755
|
return bless [ $tk ? @{ $tk } : (undef) x 3 ], $class; |
|
133
|
|
|
|
|
468
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub name { |
82
|
0
|
|
|
0
|
|
|
return shift->[ID_NAME]; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub version { |
86
|
0
|
|
|
0
|
|
|
my $self = shift; |
87
|
0
|
|
0
|
|
|
|
my $type = shift || q{}; |
88
|
0
|
|
0
|
|
|
|
return $self->[ $type eq 'raw' ? ID_VERSION_RAW : ID_VERSION ] || 0; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |