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   71381 use 5.008009;
  2         8  
4 2     2   13 use strict;
  2         6  
  2         51  
5 2     2   10 use warnings;
  2         7  
  2         55  
6 2     2   752 use parent qw/Exporter/;
  2         583  
  2         12  
7             our $VERSION = '1.000005';
8             our @EXPORT_OK = qw/off/;
9              
10             our $OFF_URL = 'http://offliberty.com/off03.php';
11              
12 2     2   1351 use HTML::TreeBuilder;
  2         49327  
  2         22  
13 2     2   1456 use HTTP::Tiny;
  2         70101  
  2         282  
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 631 my ($url, @params) = @_;
19 2         17 my $ret = $http->post_form($OFF_URL, {track => $url, @params});
20 2 50       22752092 die $ret->{reason} unless $ret->{success}; ## no critic (RequireCarping)
21 2         25 my $root = HTML::TreeBuilder->new_from_content($ret->{content});
22 2         16995 map { $_->attr('href') } $root->look_down(qw/_tag a class download/);
  3         854  
23             }
24              
25             1;
26             __END__