NAME

WWW::CurlOO::Share - Perl interface for curl_share_* functions

SYNOPSIS

use WWW::CurlOO::Share qw(:constants);

my $share = WWW::CurlOO::Share->new();
$share->setopt( CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE );
$share->setopt( CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS );

$easy_one->setopt( CURLOPT_SHARE() => $share );

$easy_two->setopt( CURLOPT_SHARE() => $share );

DESCRIPTION

This module wraps share handle from libcurl and all related functions and constants. It does not export by default anything, but constants can be exported upon request.

use WWW::CurlOO::Share qw(:constants);

CONSTRUCTOR

new( [BASE] )

Creates new WWW::CurlOO::Share object. If BASE is specified it will be used as object base, otherwise an empty hash will be used. BASE must be a valid reference which has not been blessed already. It will not be used by the object.

my $share = WWW::CurlOO::Share->new( [qw(my very private data)] );

Calls curl_share_init(3).

METHODS

setopt( OPTION, VALUE )

Set an option. OPTION is a numeric value, use one of CURLSHOPT_* constants. VALUE depends on whatever that option expects.

$share->setopt( CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE );

Calls curl_share_setopt(3). Throws "WWW::CurlOO::Share::Code" on error.

FUNCTIONS

None of those functions are exported, you must use fully qualified names.

strerror( [WHATEVER], CODE )

Return a string for error code CODE.

my $message = WWW::CurlOO::Share::strerror( CURLSHE_BAD_OPTION );

See curl_share_strerror(3) for more info.

CONSTANTS

CURLSHOPT_*

Values for setopt().

CURL_LOCK_ACCESS_*

Values passed to lock callbacks. Unused.

CURL_LOCK_DATA_*

Values passed to lock and unlock callbacks. Unused.

CURL_LOCK_DATA_COOKIE, CURL_LOCK_DATA_DNS

Values used to enable/disable shareing.

CALLBACKS

Reffer to libcurl documentation for more detailed info on each of those.

CURLSHOPT_LOCKFUNC ( CURLSHOPT_USERDATA )

Not supported. Locking is done internally.

CURLSHOPT_UNLOCKFUNC ( CURLSHOPT_USERDATA )

Not supported. (Un)Locking is done internally.

WWW::CurlOO::Share::Code

WWW::CurlOO::Share setopt method on failure throws a WWW::CurlOO::Share::Code error object. It has both numeric value and, when used as string, it calls strerror() function to display a nice message.

SEE ALSO

WWW::CurlOO WWW::CurlOO::Easy WWW::CurlOO::Multi WWW::CurlOO::examples libcurl-share(3) libcurl-errors(3)

COPYRIGHT

Copyright (c) 2011 Przemyslaw Iskra <sparky at pld-linux.org>.

You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the Software is furnished to do so, under the terms of the MPL or the MIT/X-derivate licenses. You may pick one of these licenses.