NAME

Net::Curl::Easier - Convenience wrapper around Net::Curl::Easy

SYNOPSIS

my $easy = Net::Curl::Easier->new( url => 'http://perl.org' )->perform();

print $easy->body();

# … or, to dig in to the response:
my $response = HTTP::Response->parse( $easy->head() . $easy->body() );

DESCRIPTION

Net::Curl is wonderful, but Net::Curl::Easy is a bit clunky for day-to-day use. This library attempts to make that, well, “easier”. :-)

This module extends Net::Curl::Easy, with differences as noted here:

DIFFERENCES FROM Net::Curl::Easy

SEE ALSO

METHODS

Besides those inherited from Net::Curl::Easy, this class defines:

$obj = OBJ->set( $NAME1 => $VALUE1, $NAME2 => $VALUE2, .. )

setopt()s multiple values in a single call. Instead of:

$easy->setopt( Net::Curl::Easy::CURLOPT_URL, 'http://perl.org' );
$easy->setopt( Net::Curl::Easy::CURLOPT_VERBOSE, 1 );

… you can do:

$easy->set( url => 'http://perl.org', verbose => 1 );

See curl_easy_setopt(3) for the full set of options you can give here.

Note that, since OBJ is returned, you can chain calls to this with calls to other methods like perform().

You may not need to call this method since new() calls it for you.

$obj = OBJ->push( $NAME1 => \@VALUES1, $NAME2 => \@VALUES2, .. )

Like set(), but for pushopt().

$value = OBJ->get($NAME)

Like set(), but for getinfo(). This, of course, doesn’t return OBJ, so it can’t be chained.

$str = OBJ->head()

Returns OBJ’s internal HTTP response header buffer, as a byte string.

$str = OBJ->body()

Returns the HTTP response body, as a byte string.

WRAPPED METHODS

STATIC FUNCTIONS

For convenience, Net::Curl::Easy::strerror() is aliased in this module.

LICENSE & COPYRIGHT

Copyright 2021 by Gasper Software Consulting. All rights reserved.

This library is licensed under the same terms as Perl itself. See perlartistic for details.