Couchbase::Client::Return - Common return datatype for Couchbase
This is the common datatype for couchbase operations. Each operation (e.g. get, set etc.) will typically have complex return types to facilitate various types of errors and status reports.
get
set
The object is implemented as a simple array whose constants are available in Couchbase::Client::IDXConst if performance is an issue for calling the methods
Couchbase::Client::IDXConst
errnum is the Couchbase specific error code indicating stataus. An operation is successful if errnum is equal to COUCHBASE_SUCCESS.
errnum
COUCHBASE_SUCCESS
The is_ok function does this check internally, and will probably look nicer in your code.
is_ok
Some error definitions and explanations can be found in Couchbase::Client::Errors
A human-readable representation of errnum
only valid for get operations
The returned value for the request. If this is undef it might be advisable to check error status.
undef
The opaque CAS item used for atomic updates.
While the protocol itself defines CAS as a <unit64_t>, in perl it is stored as the equivalent of a pack("Q", $casval) (this is not the actual code used, but an unpack("Q", $casval) will yield the numeric value)
pack("Q", $casval)
unpack("Q", $casval)
CAS values will always be returned for get-like functions.
Some nice magic in this module.
Instead of doing this:
if($ret->errnum == COUCHBASE_KEY_EEXISTS) { ... }
you can do this
if($ret->KEY_EEXISTS) { ... }
In other words, you can call any error 'basename' (that is, the error without the COUCHBASE_ prefix) as a method on this object, and its return value will be a boolean indicating whether errnum is equal to COUCHBASE_$name
COUCHBASE_
COUCHBASE_$name
To install Couchbase::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Couchbase::Client
CPAN shell
perl -MCPAN -e shell install Couchbase::Client
For more information on module installation, please visit the detailed CPAN module installation guide.