typedef struct refcounted_he COPHH;
#define COPHH_KEY_UTF8 REFCOUNTED_HE_KEY_UTF8 #define COPHH_EXISTS REFCOUNTED_HE_EXISTS
/* =for apidoc Amx|SV *|cophh_fetch_pv |const COPHH *cophh|const char *key |U32 hash|U32 flags =for apidoc_item|SV *|cophh_fetch_pvn|const COPHH *cophh|const char *key|STRLEN keylen|U32 hash|U32 flags =for apidoc_item|SV *|cophh_fetch_pvs|const COPHH *cophh| "key" |U32 flags =for apidoc_item|SV *|cophh_fetch_sv |const COPHH *cophh| SV *key |U32 hash|U32 flags
These look up the entry in the cop hints hash cophh
with the key specified by key
(and keylen
in the pvn
form), returning that value as a mortal scalar copy, or &PL_sv_placeholder
if there is no value associated with the key.
The forms differ in how the key is specified. In the plain pv
form, the key is a C language NUL-terminated string. In the pvs
form, the key is a C language string literal. In the pvn
form, an additional parameter, keylen
, specifies the length of the string, which hence, may contain embedded-NUL characters. In the sv
form, *key
is an SV, and the key is the PV extracted from that. using "SvPV_const"
.
hash
is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the pvs
form, as it is computed automatically at compile time.
The only flag currently used from the flags
parameter is COPHH_KEY_UTF8
. It is illegal to set this in the sv
form. In the pv*
forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The sv
form uses the underlying SV to determine the UTF-8ness of the octets.
These look up the hint entry in the cop cop
with the key specified by key
(and keylen
in the pvn
form), returning true if a value exists, and false otherwise.
The forms differ in how the key is specified. In the plain pv
form, the key is a C language NUL-terminated string. In the pvs
form, the key is a C language string literal. In the pvn
form, an additional parameter, keylen
, specifies the length of the string, which hence, may contain embedded-NUL characters. In the sv
form, *key
is an SV, and the key is the PV extracted from that. using "SvPV_const"
.
hash
is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the pvs
form, as it is computed automatically at compile time.
The only flag currently used from the flags
parameter is COPHH_KEY_UTF8
. It is illegal to set this in the sv
form. In the pv*
forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The sv
form uses the underlying SV to determine the UTF-8ness of the octets.
Generates and returns a standard Perl hash representing the full set of key/value pairs in the cop hints hash cophh
. flags
is currently unused and must be zero.
Make and return a complete copy of the cop hints hash cophh
.
Discard the cop hints hash cophh
, freeing all resources associated with it.
Generate and return a fresh cop hints hash containing no entries.
These store a value, associated with a key, in the cop hints hash cophh
, and return the modified hash. The returned hash pointer is in general not the same as the hash pointer that was passed in. The input hash is consumed by the function, and the pointer to it must not be subsequently used. Use "cophh_copy" if you need both hashes.
value
is the scalar value to store for this key. value
is copied by these functions, which thus do not take ownership of any reference to it, and hence later changes to the scalar will not be reflected in the value visible in the cop hints hash. Complex types of scalar will not be stored with referential integrity, but will be coerced to strings.
The forms differ in how the key is specified. In all forms, the key is pointed to by key
. In the plain pv
form, the key is a C language NUL-terminated string. In the pvs
form, the key is a C language string literal. In the pvn
form, an additional parameter, keylen
, specifies the length of the string, which hence, may contain embedded-NUL characters. In the sv
form, *key
is an SV, and the key is the PV extracted from that. using "SvPV_const"
.
hash
is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the pvs
form, as it is computed automatically at compile time.
The only flag currently used from the flags
parameter is COPHH_KEY_UTF8
. It is illegal to set this in the sv
form. In the pv*
forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The sv
form uses the underlying SV to determine the UTF-8ness of the octets.
These delete a key and its associated value from the cop hints hash cophh
, and return the modified hash. The returned hash pointer is in general not the same as the hash pointer that was passed in. The input hash is consumed by the function, and the pointer to it must not be subsequently used. Use "cophh_copy" if you need both hashes.
The forms differ in how the key is specified. In all forms, the key is pointed to by key
. In the plain pv
form, the key is a C language NUL-terminated string. In the pvs
form, the key is a C language string literal. In the pvn
form, an additional parameter, keylen
, specifies the length of the string, which hence, may contain embedded-NUL characters. In the sv
form, *key
is an SV, and the key is the PV extracted from that. using "SvPV_const"
.
hash
is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the pvs
form, as it is computed automatically at compile time.
The only flag currently used from the flags
parameter is COPHH_KEY_UTF8
. It is illegal to set this in the sv
form. In the pv*
forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The sv
form uses the underlying SV to determine the UTF-8ness of the octets.
These look up the hint entry in the cop cop
with the key specified by key
(and keylen
in the pvn
form), returning that value as a mortal scalar copy, or &PL_sv_placeholder
if there is no value associated with the key.
The forms differ in how the key is specified. In the plain pv
form, the key is a C language NUL-terminated string. In the pvs
form, the key is a C language string literal. In the pvn
form, an additional parameter, keylen
, specifies the length of the string, which hence, may contain embedded-NUL characters. In the sv
form, *key
is an SV, and the key is the PV extracted from that. using "SvPV_const"
.
hash
is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the pvs
form, as it is computed automatically at compile time.
The only flag currently used from the flags
parameter is COPHH_KEY_UTF8
. It is illegal to set this in the sv
form. In the pv*
forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The sv
form uses the underlying SV to determine the UTF-8ness of the octets.
These look up the hint entry in the cop cop
with the key specified by key
(and keylen
in the pvn
form), returning true if a value exists, and false otherwise.
The forms differ in how the key is specified. In all forms, the key is pointed to by key
. In the plain pv
form, the key is a C language NUL-terminated string. In the pvs
form, the key is a C language string literal. In the pvn
form, an additional parameter, keylen
, specifies the length of the string, which hence, may contain embedded-NUL characters. In the sv
form, *key
is an SV, and the key is the PV extracted from that. using "SvPV_const"
.
hash
is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the pvs
form, as it is computed automatically at compile time.
The only flag currently used from the flags
parameter is COPHH_KEY_UTF8
. It is illegal to set this in the sv
form. In the pv*
forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The sv
form uses the underlying SV to determine the UTF-8ness of the octets.
Generates and returns a standard Perl hash representing the full set of hint entries in the cop cop
. flags
is currently unused and must be zero.
These return the label attached to a cop.
CopLABEL_len
and CopLABEL_len_flags
additionally store the number of bytes comprising the returned label into *len
.
CopLABEL_len_flags
additionally returns the UTF-8ness of the returned label, by setting *flags
to 0 or SVf_UTF8
.