File Coverage

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


line stmt bran cond sub pod time code
1             package WWW::Offliberty;
2              
3 2     2   243362 use 5.008009;
  2         13  
4 2     2   9 use strict;
  2         4  
  2         31  
5 2     2   8 use warnings;
  2         11  
  2         52  
6 2     2   450 use parent qw/Exporter/;
  2         441  
  2         8  
7             our $VERSION = '1.000007';
8             our @EXPORT_OK = qw/off/;
9              
10             our $OFF_URL = 'http://offliberty.com/off04.php';
11              
12 2     2   1036 use HTML::TreeBuilder;
  2         45752  
  2         18  
13 2     2   1111 use HTTP::Tiny;
  2         68651  
  2         275  
14              
15             our $http = HTTP::Tiny->new(agent => "WWW-Offliberty/$VERSION ", default_headers => {Referer => 'http://offliberty.com/'});
16              
17             sub off{
18 1     1 0 72 my ($url, @params) = @_;
19 1         8 my $ret = $http->post_form($OFF_URL, {track => $url, @params});
20 1 50       60185005 die $ret->{reason} unless $ret->{success}; ## no critic (RequireCarping)
21 0           my $root = HTML::TreeBuilder->new_from_content($ret->{content});
22 0           map { $_->attr('href') } $root->look_down(qw/_tag a class download/);
  0            
23             }
24              
25             1;
26             __END__