Do not depend on LWP
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 6 Jun 2015 19:32:14 +0000 (22:32 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 6 Jun 2015 19:32:29 +0000 (22:32 +0300)
Makefile.PL
README
lib/WWW/BackpackTF.pm
t/50-network.t

index 6d4a2b77a965f7917a53f598625ec61223d88a81..d08e328a741d43fa8a1ee6c5c98a8d9d3adda62e 100644 (file)
@@ -11,11 +11,10 @@ WriteMakefile(
        SIGN              => 1,
        PREREQ_PM         => {
                qw/JSON::MaybeXS 0
        SIGN              => 1,
        PREREQ_PM         => {
                qw/JSON::MaybeXS 0
-                  LWP::Simple 0
                   PerlX::Maybe 0/,
        },
        BUILD_REQUIRES    => {
                   PerlX::Maybe 0/,
        },
        BUILD_REQUIRES    => {
-               qw/LWP::Online 0/,
+               qw/Test::RequiresInternet 0/,
        },
        META_MERGE        => {
                dynamic_config => 0,
        },
        META_MERGE        => {
                dynamic_config => 0,
diff --git a/README b/README
index 01b8a5946c5d5349c73737ef704254b74d80b112..9483b547c3acca629526833d3279bf59560a0ef0 100644 (file)
--- a/README
+++ b/README
@@ -19,7 +19,6 @@ DEPENDENCIES
 This module requires these other modules and libraries:
 
 * JSON
 This module requires these other modules and libraries:
 
 * JSON
-* LWP
 
 COPYRIGHT AND LICENCE
 
 
 COPYRIGHT AND LICENCE
 
index 015d9fa3a810121009503f7de23cc33c2b0200e6..7f485d6900a3d6604759a0399cbd7fc8459dcbaf 100644 (file)
@@ -23,18 +23,22 @@ BEGIN {
 }
 
 use JSON::MaybeXS qw/decode_json/;
 }
 
 use JSON::MaybeXS qw/decode_json/;
-use LWP::Simple qw/get/;
+use HTTP::Tiny;
 use PerlX::Maybe;
 use WWW::BackpackTF::Currency;
 use WWW::BackpackTF::Item;
 use WWW::BackpackTF::User;
 
 use PerlX::Maybe;
 use WWW::BackpackTF::Currency;
 use WWW::BackpackTF::Item;
 use WWW::BackpackTF::User;
 
+my $ht = HTTP::Tiny->new(agent => "WWW-BackpackTF/$VERSION");
+
 sub request {
        my ($self, $url, %params) = @_;
        $params{key} = $self->{key} if $self->{key};
        $url = $self->{base} . $url;
        $url .= "&$_=$params{$_}" for keys %params;
 sub request {
        my ($self, $url, %params) = @_;
        $params{key} = $self->{key} if $self->{key};
        $url = $self->{base} . $url;
        $url .= "&$_=$params{$_}" for keys %params;
-       my $response = decode_json(get $url)->{response};
+       my $htr = $ht->get($url);
+       die $htr->{reason} unless $htr->{success};
+       my $response = decode_json($htr->{content})->{response};
        die $response->{message} unless $response->{success};
        $response
 }
        die $response->{message} unless $response->{success};
        $response
 }
index 3f58417405e0437ed8350738d1791b64177be2a9..8f37da40976da64155d2356f45f603c79caed26d 100644 (file)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-use LWP::Online ':skip_all';
+use Test::RequiresInternet 'backpack.tf' => 80;
 use Test::More tests => 6;
 use WWW::BackpackTF;
 
 use Test::More tests => 6;
 use WWW::BackpackTF;
 
This page took 0.012613 seconds and 4 git commands to generate.