line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Alexa::TrafficRank;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
11725
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
90
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings;
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
73
|
|
5
|
2
|
|
|
2
|
|
9
|
use vars qw($VERSION);
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
90
|
|
6
|
2
|
|
|
2
|
|
4510
|
use LWP::UserAgent;
|
|
2
|
|
|
|
|
110756
|
|
|
2
|
|
|
|
|
443
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '1.10';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new
|
11
|
|
|
|
|
|
|
{
|
12
|
1
|
|
|
1
|
1
|
11
|
my $class = shift;
|
13
|
1
|
|
|
|
|
2
|
my %par = @_;
|
14
|
1
|
|
|
|
|
2
|
my $self;
|
15
|
|
|
|
|
|
|
|
16
|
1
|
50
|
50
|
|
|
14
|
$self->{ua} = LWP::UserAgent->new(agent => $par{agent} || 'Opera 11.1') or return;
|
17
|
1
|
50
|
|
|
|
7689
|
$self->{ua}->proxy('http', $par{proxy}) if $par{proxy};
|
18
|
1
|
50
|
|
|
|
4
|
$self->{ua}->timeout($par{timeout}) if $par{timeout};
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
7
|
bless ($self, $class);
|
21
|
|
|
|
|
|
|
}
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get
|
24
|
|
|
|
|
|
|
{
|
25
|
1
|
|
|
1
|
1
|
6
|
my ($self, $domain) = @_;
|
26
|
|
|
|
|
|
|
|
27
|
1
|
50
|
|
|
|
4
|
return unless defined $domain;
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
9
|
my $res = $self->{ua}->get("http://xml.alexa.com/data?cli=10&dat=nsa&url=$domain");
|
30
|
1
|
50
|
|
|
|
293115
|
return $res->status_line if !$res->is_success;
|
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
19
|
my ($rank) = $res->content =~ /
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
43
|
return $rank;
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1;
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__
|