Net::Curl::Share(3)

NAME
Net::Curl::Share - Perl interface for curl_share_* functions

SYNOPSIS
 use Net::Curl::Share qw(:constants);

 my $share = Net::Curl::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 Net::Curl::Share qw(:constants);

  CONSTRUCTOR

new( [BASE] )
    Creates new Net::Curl::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 = Net::Curl::Share->new( [qw(my very private data)] );

    Calls curl_share_init(3) <https://curl.haxx.se/libcurl/c/curl_share_init.html>.

  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) <https://curl.haxx.se/libcurl/c/curl_share_setopt.html>. Throws "Net::Curl::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 = Net::Curl::Share::strerror( CURLSHE_BAD_OPTION );

    See curl_share_strerror(3) <https://curl.haxx.se/libcurl/c/curl_share_strerror.html> 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.

  Net::Curl::Share::Code
Net::Curl::Share setopt method on failure throws a Net::Curl::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
Net::Curl Net::Curl::Easy Net::Curl::Multi Net::Curl::examples libcurl-share(3) libcurl-errors(3)

COPYRIGHT
Copyright (c) 2011-2015 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.