File Coverage

blib/lib/WWW/Offliberty.pm
Criterion Covered Total %
statement 23 23 100.0
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 31 33 93.9


line stmt bran cond sub pod time code
1             package WWW::Offliberty;
2              
3 2     2   269848 use 5.008009;
  2         13  
4 2     2   18 use strict;
  2         6  
  2         70  
5 2     2   13 use warnings;
  2         9  
  2         100  
6 2     2   605 use parent qw/Exporter/;
  2         638  
  2         14  
7             our $VERSION = '1.000006';
8             our @EXPORT_OK = qw/off/;
9              
10             our $OFF_URL = 'http://offliberty.com/off03.php';
11              
12 2     2   1408 use HTML::TreeBuilder;
  2         76483  
  2         23  
13 2     2   1351 use HTTP::Tiny;
  2         87095  
  2         342  
14              
15             our $http = HTTP::Tiny->new(agent => "WWW-Offliberty/$VERSION ", default_headers => {Referer => 'http://offliberty.com/'});
16              
17             sub off{
18 2     2 0 11512 my ($url, @params) = @_;
19 2         38 my $ret = $http->post_form($OFF_URL, {track => $url, @params});
20 2 50       18889602 die $ret->{reason} unless $ret->{success}; ## no critic (RequireCarping)
21 2         31 my $root = HTML::TreeBuilder->new_from_content($ret->{content});
22 2         23901 map { $_->attr('href') } $root->look_down(qw/_tag a class download/);
  4         1075  
23             }
24              
25             1;
26             __END__