line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Curl::Simple::UserAgent; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1779
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
66
|
|
5
|
2
|
|
|
2
|
|
2408
|
use Net::Curl::Share qw(CURLSHOPT_SHARE /^CURL_LOCK_DATA_/); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use base qw(Net::Curl::Share); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %common_options = ( |
11
|
|
|
|
|
|
|
useragent => __PACKAGE__ . ' v' . $VERSION, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub setopts |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
my $share = shift; |
17
|
|
|
|
|
|
|
my %opts = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$share = \%common_options |
20
|
|
|
|
|
|
|
unless ref $share; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
@$share{ keys %opts } = values %opts; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
*setopt = \&setopts; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
my $class = shift; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $share = $class->SUPER::new(); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$share->SUPER::setopt( CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE ); |
33
|
|
|
|
|
|
|
$share->SUPER::setopt( CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS ); |
34
|
|
|
|
|
|
|
$share->setopts( %common_options, @_ ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $share; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub curl |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
my $share = shift; |
42
|
|
|
|
|
|
|
require Net::Curl::Simple; |
43
|
|
|
|
|
|
|
return Net::Curl::Simple->new( %$share, @_, share => $share ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |