Skip to content

Commit

Permalink
Replace WWW::Curl with Net::Curl
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeallenx authored and lorn committed Oct 15, 2015
1 parent 9595c1d commit 3b6e4b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/LWP/Curl.pm
Expand Up @@ -2,7 +2,7 @@ package LWP::Curl;

use warnings;
use strict;
use WWW::Curl::Easy;
use Net::Curl::Easy qw(:constants);
use Carp qw(croak);
use Data::Dumper;
use URI::Escape;
Expand Down Expand Up @@ -123,7 +123,7 @@ sub new {
my $debug = delete $args{debug};
$self->{debug} = 0 unless defined $debug;
print STDERR "\n Hash Debug: \n" . Dumper($self) . "\n" if $debug;
$self->{agent} = WWW::Curl::Easy->new();
$self->{agent} = Net::Curl::Easy->new();
$self->{agent}->setopt( CURLOPT_TIMEOUT, $timeout );
$self->{agent}->setopt( CURLOPT_USERAGENT, $user_agent );
$self->{agent}->setopt( CURLOPT_HEADER, $headers );
Expand Down Expand Up @@ -172,7 +172,7 @@ sub get {
$agent->setopt( CURLOPT_WRITEDATA, $fileb );
$self->{retcode} = $agent->perform;

if ( $self->{retcode} == 0 ) {
if ( ! defined $self->{retcode} ) {
my $response_code = $agent->getinfo(CURLINFO_HTTP_CODE);
if ($response_code == 200 || ($response_code == 0 && $url =~ m!^file:!)) {
print("\nTransfer went ok\n") if $self->{debug};
Expand Down

0 comments on commit 3b6e4b0

Please sign in to comment.