NAME
WWW::CurlOO::Share - Perl interface for curl_share_* functions
WARNING
THIS MODULE IS UNDER HEAVY DEVELOPEMENT AND SOME INTERFACE MAY CHANGE YET.
SYNOPSIS
use WWW::CurlOO::Share qw(:constants);
my $share = WWW::CurlOO::Share->new();
$share->setopt( CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE );
$easy1->setopt( CURLOPT_SHARE() => $share );
$easy2->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).
- DESTROY( )
-
Cleans up. It should not be called manually.
Calls curl_share_cleanup(3).
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.
- CURL_LOCK_DATA_*
-
Values passed to lock and unlock callbacks.
CALLBACKS
Reffer to libcurl documentation for more detailed info on each of those.
- CURLSHOPT_LOCKFUNC ( CURLSHOPT_USERDATA )
-
Lock callback receives 4 arguments: easy object, lock data, lock access, and CURLSHOPT_USERDATA value.
sub cb_lock { my ( $easy, $data, $locktype, $uservar ) = @_; # ... lock ... }
- CURLSHOPT_UNLOCKFUNC ( CURLSHOPT_USERDATA )
-
Unlock callback receives 3 arguments: easy object, lock data, and CURLSHOPT_USERDATA value.
sub cb_unlock { my ( $easy, $data, $uservar ) = @_; # ... unlock ... }
SEE ALSO
WWW::CurlOO WWW::CurlOO::Easy WWW::CurlOO::Multi
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.