LibCurl::EasyHandle

NAME

LibCurl::EasyHandle

SYNOPSIS

use LibCurl::EasyHandle;

curl_global_init(CURL_GLOBAL_DEFAULT);

say curl_version;

my $handle = LibCurl::EasyHandle.new;

$handle.setopt(CURLOPT_URL, "http://example.com");

$handle.perform;

say $handle.getinfo(CURL_GETINFO_RESPONSE_CODE);

$handle.cleanup;

curl_global_cleanup;

DESCRIPTION

LibCurl::EasyHandle is the low level NativeCall interface to libcurl's easy interface. In general you should be using the LibCurl::Easy interface instead.

SUBROUTINES

  • sub curl_global_init(long $flags) returns uint32

Nativecall version of curl_global_init. It can take the following $flags: CURL_GLOBAL_SSL, CURL_GLOBAL_WIN32, CURL_GLOBAL_ALL, CURL_GLOBAL_NOTHING, CURL_GLOBAL_DEFAULT, CURL_GLOBAL_ACK_EINTR.

  • sub curl_global_cleanup()

Nativecall version of curl_global_cleanup.

  • sub curl_version() returns Str

Nativecall version of curl_version.

CLASSES

class X::LibCurl is Exception

Wraps libcurl error code.

  • method Int() returns Int

Returns the CURLcode for the error.

  • method message() returns Str

Returns the Str version of the error from curl_easy_strerror.

class LibCurl::slist-struct is repr('CStruct')

Wrapper for struct curl_slist.

  • has Str $.data

  • has Pointer $.next

class LibCurl::slist is repr('CPointer')

Wrapper for a pointer to a struct curl_slist.

  • method append(*@str-list) returns LibCurl::slist

Wrapper for curl_slist_append, but can take a list of strings and they all get appended.

  • method list() returns Array

Extract the list of strings into a Perl Array.

  • method free()

Wrapper for curl_slist_free_all.

LibCurl::certinfo is repr('CStruct')

LibCurl::EasyHandle is repr('CStruct')

Wrapper for struct CURL.

  • method new() returns LibCurl::EasyHandle

Wrapper for curl_easy_init to create a new CURL easy handle.

  • method id() returns Str

Returns an opaque string that will be unique for every LibCurl::EasyHandle.

  • method cleanup()

Wrapper for curl_easy_cleanup.

  • method reset()

Wrapper for curl_easy_reset.

  • method duphandle() returns LibCurl::EasyHandle

Wrapper for curl_easy_duphandle.

  • method escape(Str encoding = 'utf-8')

Wrapper for curl_easy_escape.

  • method unescape(Str encoding = 'utf-8')

Wrapper for curl_easy_unescape.

  • method perform() return uint32

Wrapper for curl_easy_perform.

  • multi method setopt(param)

  • multi method setopt($option, &callback)

  • multi method setopt(ptr)

  • multi method setopt(slist)

  • multi method setopt(ptr)

  • multi method setopt(ptr)

Wrappers for various flavors of curl_easy_setopt.

These will throw an X::LibCurl on any error.

  • method getinfo_long($option) returns long

  • method getinfo_double($option) returns num64

  • method getinfo_str($option) returns Str

  • method getinfo_certinfo() returns Array[Str]

  • method getinfo_slist($option) returns Array[Str]

Wrappers for various flavors of curl_easy_getinfo.

These will throw an X::LibCurl on any error.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.