line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::ProxyPAC::Result; |
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
107
|
|
3
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1148
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub parse { |
6
|
24
|
|
|
24
|
0
|
77
|
my($class, $string, $url) = @_; |
7
|
24
|
|
|
|
|
118
|
my @res = split /\s*;\s*/, $string; |
8
|
24
|
|
|
|
|
2190
|
map $class->_parse($_, $url), @res; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _parse { |
12
|
34
|
|
|
34
|
|
81
|
my($class, $string, $url) = @_; |
13
|
|
|
|
|
|
|
|
14
|
34
|
50
|
|
|
|
283
|
$string =~ s/^(DIRECT|PROXY|SOCKS)\s*// |
15
|
|
|
|
|
|
|
or Carp::croak("Can't parse FindProxyForURL() return value: $string"); |
16
|
|
|
|
|
|
|
|
17
|
34
|
|
|
|
|
148
|
my $self; |
18
|
34
|
|
|
|
|
270
|
$self->{type} = $1; |
19
|
|
|
|
|
|
|
|
20
|
34
|
100
|
|
|
|
127
|
if ($self->{type} ne 'DIRECT') { |
21
|
12
|
|
|
|
|
82
|
my $proxy = URI->new; |
22
|
12
|
|
|
|
|
833
|
$proxy->scheme('http'); |
23
|
12
|
|
|
|
|
1489
|
$proxy->host_port($string); |
24
|
|
|
|
|
|
|
|
25
|
12
|
|
|
|
|
1653
|
$self->{lc($self->{type})} = $proxy; |
26
|
|
|
|
|
|
|
} |
27
|
34
|
|
|
|
|
261
|
bless $self, $class; |
28
|
|
|
|
|
|
|
} |
29
|
18
|
|
|
18
|
1
|
1137
|
sub direct { $_[0]->{type} eq 'DIRECT' } |
30
|
20
|
|
|
20
|
1
|
1943
|
sub proxy { $_[0]->{proxy} } |
31
|
0
|
|
|
0
|
1
|
|
sub socks { $_[0]->{socks} } |
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |