Website hosting service by Active-Venture.com
  

 Back to Index

SV Manipulation Functions

get_sv

Returns the SV of the specified Perl scalar. If create is set and the Perl variable does not exist then it will be created. If create is not set and the variable does not exist then NULL is returned.

NOTE: the perl_ form of this function is deprecated.

 
	SV*	get_sv(const char* name, I32 create)  

looks_like_number

Test if the content of an SV looks like a number (or is a number). Inf and Infinity are treated as numbers (so will not issue a non-numeric warning), even if your atof() doesn't grok them.

 
	I32	looks_like_number(SV* sv)  

newRV_inc

Creates an RV wrapper for an SV. The reference count for the original SV is incremented.

 
	SV*	newRV_inc(SV* sv)  

newRV_noinc

Creates an RV wrapper for an SV. The reference count for the original SV is not incremented.

 
	SV*	newRV_noinc(SV *sv)  

newSV

Create a new null SV, or if len > 0, create a new empty SVt_PV type SV with an initial PV allocation of len+1. Normally accessed via the NEWSV macro.

 
	SV*	newSV(STRLEN len)  

newSViv

Creates a new SV and copies an integer into it. The reference count for the SV is set to 1.

 
	SV*	newSViv(IV i)  

newSVnv

Creates a new SV and copies a floating point value into it. The reference count for the SV is set to 1.

 
	SV*	newSVnv(NV n)  

newSVpv

Creates a new SV and copies a string into it. The reference count for the SV is set to 1. If len is zero, Perl will compute the length using strlen(). For efficiency, consider using newSVpvn instead.

 
	SV*	newSVpv(const char* s, STRLEN len)  

newSVpvf

Creates a new SV and initializes it with the string formatted like sprintf.

 
	SV*	newSVpvf(const char* pat, ...)  

newSVpvn

Creates a new SV and copies a string into it. The reference count for the SV is set to 1. Note that if len is zero, Perl will create a zero length string. You are responsible for ensuring that the source string is at least len bytes long.

 
	SV*	newSVpvn(const char* s, STRLEN len)  

newSVpvn_share

Creates a new SV with its SvPVX pointing to a shared string in the string table. If the string does not already exist in the table, it is created first. Turns on READONLY and FAKE. The string's hash is stored in the UV slot of the SV; if the hash parameter is non-zero, that value is used; otherwise the hash is computed. The idea here is that as the string table is used for shared hash keys these strings will have SvPVX == HeKEY and hash lookup will avoid string compare.

 
	SV*	newSVpvn_share(const char* s, I32 len, U32 hash)  

newSVrv

Creates a new SV for the RV, rv, to point to. If rv is not an RV then it will be upgraded to one. If classname is non-null then the new SV will be blessed in the specified package. The new SV is returned and its reference count is 1.

 
	SV*	newSVrv(SV* rv, const char* classname)  

newSVsv

Creates a new SV which is an exact duplicate of the original SV. (Uses sv_setsv).

 
	SV*	newSVsv(SV* old)  

newSVuv

Creates a new SV and copies an unsigned integer into it. The reference count for the SV is set to 1.

 
	SV*	newSVuv(UV u)  

new_vstring

Returns a pointer to the next character after the parsed vstring, as well as updating the passed in sv.

Function must be called like

 
        sv = NEWSV(92,5);
	s = new_vstring(s,sv);  

The sv must already be large enough to store the vstring passed in.

 
	char*	new_vstring(char *vstr, SV *sv)  

SvCUR

Returns the length of the string which is in the SV. See SvLEN.

 
	STRLEN	SvCUR(SV* sv)  

SvCUR_set

Set the length of the string which is in the SV. See SvCUR.

 
	void	SvCUR_set(SV* sv, STRLEN len)  

SvEND

Returns a pointer to the last character in the string which is in the SV. See SvCUR. Access the character as *(SvEND(sv)).

 
	char*	SvEND(SV* sv)  

SvGROW

Expands the character buffer in the SV so that it has room for the indicated number of bytes (remember to reserve space for an extra trailing NUL character). Calls sv_grow to perform the expansion if necessary. Returns a pointer to the character buffer.

 
	char *	SvGROW(SV* sv, STRLEN len)  

SvIOK

Returns a boolean indicating whether the SV contains an integer.

 
	bool	SvIOK(SV* sv)  

SvIOKp

Returns a boolean indicating whether the SV contains an integer. Checks the private setting. Use SvIOK.

 
	bool	SvIOKp(SV* sv)  

SvIOK_notUV

Returns a boolean indicating whether the SV contains a signed integer.

 
	void	SvIOK_notUV(SV* sv)  

SvIOK_off

Unsets the IV status of an SV.

 
	void	SvIOK_off(SV* sv)  

SvIOK_on

Tells an SV that it is an integer.

 
	void	SvIOK_on(SV* sv)  

SvIOK_only

Tells an SV that it is an integer and disables all other OK bits.

 
	void	SvIOK_only(SV* sv)  

SvIOK_only_UV

Tells and SV that it is an unsigned integer and disables all other OK bits.

 
	void	SvIOK_only_UV(SV* sv)  

SvIOK_UV

Returns a boolean indicating whether the SV contains an unsigned integer.

 
	void	SvIOK_UV(SV* sv)  

SvIV

Coerces the given SV to an integer and returns it. See SvIVx for a version which guarantees to evaluate sv only once.

 
	IV	SvIV(SV* sv)  

SvIVx

Coerces the given SV to an integer and returns it. Guarantees to evaluate sv only once. Use the more efficient SvIV otherwise.

 
	IV	SvIVx(SV* sv)  

SvIVX

Returns the raw value in the SV's IV slot, without checks or conversions. Only use when you are sure SvIOK is true. See also SvIV().

 
	IV	SvIVX(SV* sv)  

SvLEN

Returns the size of the string buffer in the SV, not including any part attributable to SvOOK. See SvCUR.

 
	STRLEN	SvLEN(SV* sv)  

SvNIOK

Returns a boolean indicating whether the SV contains a number, integer or double.

 
	bool	SvNIOK(SV* sv)  

SvNIOKp

Returns a boolean indicating whether the SV contains a number, integer or double. Checks the private setting. Use SvNIOK.

 
	bool	SvNIOKp(SV* sv)  

SvNIOK_off

Unsets the NV/IV status of an SV.

 
	void	SvNIOK_off(SV* sv)  

SvNOK

Returns a boolean indicating whether the SV contains a double.

 
	bool	SvNOK(SV* sv)  

SvNOKp

Returns a boolean indicating whether the SV contains a double. Checks the private setting. Use SvNOK.

 
	bool	SvNOKp(SV* sv)  

SvNOK_off

Unsets the NV status of an SV.

 
	void	SvNOK_off(SV* sv)  

SvNOK_on

Tells an SV that it is a double.

 
	void	SvNOK_on(SV* sv)  

SvNOK_only

Tells an SV that it is a double and disables all other OK bits.

 
	void	SvNOK_only(SV* sv)  

SvNV

Coerce the given SV to a double and return it. See SvNVx for a version which guarantees to evaluate sv only once.

 
	NV	SvNV(SV* sv)  

SvNVX

Returns the raw value in the SV's NV slot, without checks or conversions. Only use when you are sure SvNOK is true. See also SvNV().

 
	NV	SvNVX(SV* sv)  

SvNVx

Coerces the given SV to a double and returns it. Guarantees to evaluate sv only once. Use the more efficient SvNV otherwise.

 
	NV	SvNVx(SV* sv)  

SvOK

Returns a boolean indicating whether the value is an SV.

 
	bool	SvOK(SV* sv)  

SvOOK

Returns a boolean indicating whether the SvIVX is a valid offset value for the SvPVX. This hack is used internally to speed up removal of characters from the beginning of a SvPV. When SvOOK is true, then the start of the allocated string buffer is really (SvPVX - SvIVX).

 
	bool	SvOOK(SV* sv)  

SvPOK

Returns a boolean indicating whether the SV contains a character string.

 
	bool	SvPOK(SV* sv)  

SvPOKp

Returns a boolean indicating whether the SV contains a character string. Checks the private setting. Use SvPOK.

 
	bool	SvPOKp(SV* sv)  

SvPOK_off

Unsets the PV status of an SV.

 
	void	SvPOK_off(SV* sv)  

SvPOK_on

Tells an SV that it is a string.

 
	void	SvPOK_on(SV* sv)  

SvPOK_only

Tells an SV that it is a string and disables all other OK bits. Will also turn off the UTF8 status.

 
	void	SvPOK_only(SV* sv)  

SvPOK_only_UTF8

Tells an SV that it is a string and disables all other OK bits, and leaves the UTF8 status as it was.

 
	void	SvPOK_only_UTF8(SV* sv)  

SvPV

Returns a pointer to the string in the SV, or a stringified form of the SV if the SV does not contain a string. The SV may cache the stringified version becoming SvPOK. Handles 'get' magic. See also SvPVx for a version which guarantees to evaluate sv only once.

 
	char*	SvPV(SV* sv, STRLEN len)  

SvPVbyte

Like SvPV, but converts sv to byte representation first if necessary.

 
	char*	SvPVbyte(SV* sv, STRLEN len)  

SvPVbytex

Like SvPV, but converts sv to byte representation first if necessary. Guarantees to evaluate sv only once; use the more efficient SvPVbyte otherwise.

 
	char*	SvPVbytex(SV* sv, STRLEN len)  

SvPVbytex_force

Like SvPV_force, but converts sv to byte representation first if necessary. Guarantees to evaluate sv only once; use the more efficient SvPVbyte_force otherwise.

 
	char*	SvPVbytex_force(SV* sv, STRLEN len)  

SvPVbyte_force

Like SvPV_force, but converts sv to byte representation first if necessary.

 
	char*	SvPVbyte_force(SV* sv, STRLEN len)  

SvPVbyte_nolen

Like SvPV_nolen, but converts sv to byte representation first if necessary.

 
	char*	SvPVbyte_nolen(SV* sv)  

SvPVutf8

Like SvPV, but converts sv to utf8 first if necessary.

 
	char*	SvPVutf8(SV* sv, STRLEN len)  

SvPVutf8x

Like SvPV, but converts sv to utf8 first if necessary. Guarantees to evaluate sv only once; use the more efficient SvPVutf8 otherwise.

 
	char*	SvPVutf8x(SV* sv, STRLEN len)  

SvPVutf8x_force

Like SvPV_force, but converts sv to utf8 first if necessary. Guarantees to evaluate sv only once; use the more efficient SvPVutf8_force otherwise.

 
	char*	SvPVutf8x_force(SV* sv, STRLEN len)  

SvPVutf8_force

Like SvPV_force, but converts sv to utf8 first if necessary.

 
	char*	SvPVutf8_force(SV* sv, STRLEN len)  

SvPVutf8_nolen

Like SvPV_nolen, but converts sv to utf8 first if necessary.

 
	char*	SvPVutf8_nolen(SV* sv)  

SvPVx

A version of SvPV which guarantees to evaluate sv only once.

 
	char*	SvPVx(SV* sv, STRLEN len)  

SvPVX

Returns a pointer to the physical string in the SV. The SV must contain a string.

 
	char*	SvPVX(SV* sv)  

SvPV_force

Like SvPV but will force the SV into containing just a string (SvPOK_only). You want force if you are going to update the SvPVX directly.

 
	char*	SvPV_force(SV* sv, STRLEN len)  

SvPV_force_nomg

Like SvPV but will force the SV into containing just a string (SvPOK_only). You want force if you are going to update the SvPVX directly. Doesn't process magic.

 
	char*	SvPV_force_nomg(SV* sv, STRLEN len)  

SvPV_nolen

Returns a pointer to the string in the SV, or a stringified form of the SV if the SV does not contain a string. The SV may cache the stringified form becoming SvPOK. Handles 'get' magic.

 
	char*	SvPV_nolen(SV* sv)  

SvREFCNT

Returns the value of the object's reference count.

 
	U32	SvREFCNT(SV* sv)  

SvREFCNT_dec

Decrements the reference count of the given SV.

 
	void	SvREFCNT_dec(SV* sv)  

SvREFCNT_inc

Increments the reference count of the given SV.

 
	SV*	SvREFCNT_inc(SV* sv)  

SvROK

Tests if the SV is an RV.

 
	bool	SvROK(SV* sv)  

SvROK_off

Unsets the RV status of an SV.

 
	void	SvROK_off(SV* sv)  

SvROK_on

Tells an SV that it is an RV.

 
	void	SvROK_on(SV* sv)  

SvRV

Dereferences an RV to return the SV.

 
	SV*	SvRV(SV* sv)  

SvSTASH

Returns the stash of the SV.

 
	HV*	SvSTASH(SV* sv)  

SvTAINT

Taints an SV if tainting is enabled

 
	void	SvTAINT(SV* sv)  

SvTAINTED

Checks to see if an SV is tainted. Returns TRUE if it is, FALSE if not.

 
	bool	SvTAINTED(SV* sv)  

SvTAINTED_off

Untaints an SV. Be very careful with this routine, as it short-circuits some of Perl's fundamental security features. XS module authors should not use this function unless they fully understand all the implications of unconditionally untainting the value. Untainting should be done in the standard perl fashion, via a carefully crafted regexp, rather than directly untainting variables.

 
	void	SvTAINTED_off(SV* sv)  

SvTAINTED_on

Marks an SV as tainted.

 
	void	SvTAINTED_on(SV* sv)  

SvTRUE

Returns a boolean indicating whether Perl would evaluate the SV as true or false, defined or undefined. Does not handle 'get' magic.

 
	bool	SvTRUE(SV* sv)  

SvTYPE

Returns the type of the SV. See svtype.

 
	svtype	SvTYPE(SV* sv)  

SvUNLOCK

Releases a mutual exclusion lock on sv if a suitable module has been loaded.

 
	void	SvUNLOCK(SV* sv)  

SvUOK

Returns a boolean indicating whether the SV contains an unsigned integer.

 
	void	SvUOK(SV* sv)  

SvUPGRADE

Used to upgrade an SV to a more complex form. Uses sv_upgrade to perform the upgrade if necessary. See svtype.

 
	void	SvUPGRADE(SV* sv, svtype type)  

SvUTF8

Returns a boolean indicating whether the SV contains UTF-8 encoded data.

 
	void	SvUTF8(SV* sv)  

SvUTF8_off

Unsets the UTF8 status of an SV.

 
	void	SvUTF8_off(SV *sv)  

SvUTF8_on

Turn on the UTF8 status of an SV (the data is not changed, just the flag). Do not use frivolously.

 
	void	SvUTF8_on(SV *sv)  

SvUV

Coerces the given SV to an unsigned integer and returns it. See SvUVx for a version which guarantees to evaluate sv only once.

 
	UV	SvUV(SV* sv)  

SvUVX

Returns the raw value in the SV's UV slot, without checks or conversions. Only use when you are sure SvIOK is true. See also SvUV().

 
	UV	SvUVX(SV* sv)  

SvUVx

Coerces the given SV to an unsigned integer and returns it. Guarantees to evaluate sv only once. Use the more efficient SvUV otherwise.

 
	UV	SvUVx(SV* sv)  

sv_2bool

This function is only called on magical items, and is only used by sv_true() or its macro equivalent.

 
	bool	sv_2bool(SV* sv)  

sv_2cv

Using various gambits, try to get a CV from an SV; in addition, try if possible to set *st and *gvp to the stash and GV associated with it.

 
	CV*	sv_2cv(SV* sv, HV** st, GV** gvp, I32 lref)  

sv_2io

Using various gambits, try to get an IO from an SV: the IO slot if its a GV; or the recursive result if we're an RV; or the IO slot of the symbol named after the PV if we're a string.

 
	IO*	sv_2io(SV* sv)  

sv_2iv

Return the integer value of an SV, doing any necessary string conversion, magic etc. Normally used via the SvIV(sv) and SvIVx(sv) macros.

 
	IV	sv_2iv(SV* sv)  

sv_2mortal

Marks an existing SV as mortal. The SV will be destroyed "soon", either by an explicit call to FREETMPS, or by an implicit call at places such as statement boundaries. See also sv_newmortal and sv_mortalcopy.

 
	SV*	sv_2mortal(SV* sv)  

sv_2nv

Return the num value of an SV, doing any necessary string or integer conversion, magic etc. Normally used via the SvNV(sv) and SvNVx(sv) macros.

 
	NV	sv_2nv(SV* sv)  

sv_2pvbyte

Return a pointer to the byte-encoded representation of the SV, and set *lp to its length. May cause the SV to be downgraded from UTF8 as a side-effect.

Usually accessed via the SvPVbyte macro.

 
	char*	sv_2pvbyte(SV* sv, STRLEN* lp)  

sv_2pvbyte_nolen

Return a pointer to the byte-encoded representation of the SV. May cause the SV to be downgraded from UTF8 as a side-effect.

Usually accessed via the SvPVbyte_nolen macro.

 
	char*	sv_2pvbyte_nolen(SV* sv)  

sv_2pvutf8

Return a pointer to the UTF8-encoded representation of the SV, and set *lp to its length. May cause the SV to be upgraded to UTF8 as a side-effect.

Usually accessed via the SvPVutf8 macro.

 
	char*	sv_2pvutf8(SV* sv, STRLEN* lp)  

sv_2pvutf8_nolen

Return a pointer to the UTF8-encoded representation of the SV. May cause the SV to be upgraded to UTF8 as a side-effect.

Usually accessed via the SvPVutf8_nolen macro.

 
	char*	sv_2pvutf8_nolen(SV* sv)  

sv_2pv_flags

Returns a pointer to the string value of an SV, and sets *lp to its length. If flags includes SV_GMAGIC, does an mg_get() first. Coerces sv to a string if necessary. Normally invoked via the SvPV_flags macro. sv_2pv() and sv_2pv_nomg usually end up here too.

 
	char*	sv_2pv_flags(SV* sv, STRLEN* lp, I32 flags)  

sv_2pv_nolen

Like sv_2pv(), but doesn't return the length too. You should usually use the macro wrapper SvPV_nolen(sv) instead. char* sv_2pv_nolen(SV* sv)

sv_2uv

Return the unsigned integer value of an SV, doing any necessary string conversion, magic etc. Normally used via the SvUV(sv) and SvUVx(sv) macros.

 
	UV	sv_2uv(SV* sv)  

sv_backoff

Remove any string offset. You should normally use the SvOOK_off macro wrapper instead.

 
	int	sv_backoff(SV* sv)  

sv_bless

Blesses an SV into a specified package. The SV must be an RV. The package must be designated by its stash (see gv_stashpv()). The reference count of the SV is unaffected.

 
	SV*	sv_bless(SV* sv, HV* stash)  

sv_catpv

Concatenates the string onto the end of the string which is in the SV. If the SV has the UTF8 status set, then the bytes appended should be valid UTF8. Handles 'get' magic, but not 'set' magic. See sv_catpv_mg.

 
	void	sv_catpv(SV* sv, const char* ptr)  

sv_catpvf

Processes its arguments like sprintf and appends the formatted output to an SV. If the appended data contains "wide" characters (including, but not limited to, SVs with a UTF-8 PV formatted with %s, and characters >255 formatted with %c), the original SV might get upgraded to UTF-8. Handles 'get' magic, but not 'set' magic. SvSETMAGIC() must typically be called after calling this function to handle 'set' magic.

 
	void	sv_catpvf(SV* sv, const char* pat, ...)  

sv_catpvf_mg

Like sv_catpvf, but also handles 'set' magic.

 
	void	sv_catpvf_mg(SV *sv, const char* pat, ...)  

sv_catpvn

Concatenates the string onto the end of the string which is in the SV. The len indicates number of bytes to copy. If the SV has the UTF8 status set, then the bytes appended should be valid UTF8. Handles 'get' magic, but not 'set' magic. See sv_catpvn_mg.

 
	void	sv_catpvn(SV* sv, const char* ptr, STRLEN len)  

sv_catpvn_flags

Concatenates the string onto the end of the string which is in the SV. The len indicates number of bytes to copy. If the SV has the UTF8 status set, then the bytes appended should be valid UTF8. If flags has SV_GMAGIC bit set, will mg_get on dsv if appropriate, else not. sv_catpvn and sv_catpvn_nomg are implemented in terms of this function.

 
	void	sv_catpvn_flags(SV* sv, const char* ptr, STRLEN len, I32 flags)  

sv_catpvn_mg

Like sv_catpvn, but also handles 'set' magic.

 
	void	sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len)  

sv_catpv_mg

Like sv_catpv, but also handles 'set' magic.

 
	void	sv_catpv_mg(SV *sv, const char *ptr)  

sv_catsv

Concatenates the string from SV ssv onto the end of the string in SV dsv. Modifies dsv but not ssv. Handles 'get' magic, but not 'set' magic. See sv_catsv_mg.

 
	void	sv_catsv(SV* dsv, SV* ssv)  

sv_catsv_flags

Concatenates the string from SV ssv onto the end of the string in SV dsv. Modifies dsv but not ssv. If flags has SV_GMAGIC bit set, will mg_get on the SVs if appropriate, else not. sv_catsv and sv_catsv_nomg are implemented in terms of this function.

 
	void	sv_catsv_flags(SV* dsv, SV* ssv, I32 flags)  

sv_catsv_mg

Like sv_catsv, but also handles 'set' magic.

 
	void	sv_catsv_mg(SV *dstr, SV *sstr)  

sv_chop

Efficient removal of characters from the beginning of the string buffer. SvPOK(sv) must be true and the ptr must be a pointer to somewhere inside the string buffer. The ptr becomes the first character of the adjusted string. Uses the "OOK hack".

 
	void	sv_chop(SV* sv, char* ptr)  

sv_clear

Clear an SV: call any destructors, free up any memory used by the body, and free the body itself. The SV's head is not freed, although its type is set to all 1's so that it won't inadvertently be assumed to be live during global destruction etc. This function should only be called when REFCNT is zero. Most of the time you'll want to call sv_free() (or its macro wrapper SvREFCNT_dec) instead.

 
	void	sv_clear(SV* sv)  

sv_cmp

Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the string in sv1 is less than, equal to, or greater than the string in sv2. Is UTF-8 and 'use bytes' aware, handles get magic, and will coerce its args to strings if necessary. See also sv_cmp_locale.

 
	I32	sv_cmp(SV* sv1, SV* sv2)  

sv_cmp_locale

Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and 'use bytes' aware, handles get magic, and will coerce its args to strings if necessary. See also sv_cmp_locale. See also sv_cmp.

 
	I32	sv_cmp_locale(SV* sv1, SV* sv2)  

sv_collxfrm

Add Collate Transform magic to an SV if it doesn't already have it.

Any scalar variable may carry PERL_MAGIC_collxfrm magic that contains the scalar data of the variable, but transformed to such a format that a normal memory comparison can be used to compare the data according to the locale settings.

 
	char*	sv_collxfrm(SV* sv, STRLEN* nxp)  

sv_copypv

Copies a stringified representation of the source SV into the destination SV. Automatically performs any necessary mg_get and coercion of numeric values into strings. Guaranteed to preserve UTF-8 flag even from overloaded objects. Similar in nature to sv_2pv[_flags] but operates directly on an SV instead of just the string. Mostly uses sv_2pv_flags to do its work, except when that would lose the UTF-8'ness of the PV.

 
	void	sv_copypv(SV* dsv, SV* ssv)  

sv_dec

Auto-decrement of the value in the SV, doing string to numeric conversion if necessary. Handles 'get' magic.

 
	void	sv_dec(SV* sv)  

sv_derived_from

Returns a boolean indicating whether the SV is derived from the specified class. This is the function that implements UNIVERSAL::isa. It works for class names as well as for objects.

 
	bool	sv_derived_from(SV* sv, const char* name)  

sv_eq

Returns a boolean indicating whether the strings in the two SVs are identical. Is UTF-8 and 'use bytes' aware, handles get magic, and will coerce its args to strings if necessary.

 
	I32	sv_eq(SV* sv1, SV* sv2)  

sv_force_normal

Undo various types of fakery on an SV: if the PV is a shared string, make a private copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg. See also sv_force_normal_flags.

 
	void	sv_force_normal(SV *sv)  

sv_force_normal_flags

Undo various types of fakery on an SV: if the PV is a shared string, make a private copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg. The flags parameter gets passed to sv_unref_flags() when unrefing. sv_force_normal calls this function with flags set to 0.

 
	void	sv_force_normal_flags(SV *sv, U32 flags)  

sv_free

Decrement an SV's reference count, and if it drops to zero, call sv_clear to invoke destructors and free up any memory used by the body; finally, deallocate the SV's head itself. Normally called via a wrapper macro SvREFCNT_dec.

 
	void	sv_free(SV* sv)  

sv_gets

Get a line from the filehandle and store it into the SV, optionally appending to the currently-stored string.

 
	char*	sv_gets(SV* sv, PerlIO* fp, I32 append)  

sv_grow

Expands the character buffer in the SV. If necessary, uses sv_unref and upgrades the SV to SVt_PV. Returns a pointer to the character buffer. Use the SvGROW wrapper instead.

 
	char*	sv_grow(SV* sv, STRLEN newlen)  

sv_inc

Auto-increment of the value in the SV, doing string to numeric conversion if necessary. Handles 'get' magic.

 
	void	sv_inc(SV* sv)  

sv_insert

Inserts a string at the specified offset/length within the SV. Similar to the Perl substr() function.

 
	void	sv_insert(SV* bigsv, STRLEN offset, STRLEN len, char* little, STRLEN littlelen)  

sv_isa

Returns a boolean indicating whether the SV is blessed into the specified class. This does not check for subtypes; use sv_derived_from to verify an inheritance relationship.

 
	int	sv_isa(SV* sv, const char* name)  

sv_isobject

Returns a boolean indicating whether the SV is an RV pointing to a blessed object. If the SV is not an RV, or if the object is not blessed, then this will return false.

 
	int	sv_isobject(SV* sv)  

sv_iv

A private implementation of the SvIVx macro for compilers which can't cope with complex macro expressions. Always use the macro instead.

 
	IV	sv_iv(SV* sv)  

sv_len

Returns the length of the string in the SV. Handles magic and type coercion. See also SvCUR, which gives raw access to the xpv_cur slot.

 
	STRLEN	sv_len(SV* sv)  

sv_len_utf8

Returns the number of characters in the string in an SV, counting wide UTF8 bytes as a single character. Handles magic and type coercion.

 
	STRLEN	sv_len_utf8(SV* sv)  

sv_magic

Adds magic to an SV. First upgrades sv to type SVt_PVMG if necessary, then adds a new magic item of type how to the head of the magic list.

 
	void	sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen)  

sv_magicext

Adds magic to an SV, upgrading it if necessary. Applies the supplied vtable and returns pointer to the magic added.

Note that sv_magicext will allow things that sv_magic will not. In particular you can add magic to SvREADONLY SVs and and more than one instance of the same 'how'

I namelen is greater then zero then a savepvn() copy of name is stored, if namelen is zero then name is stored as-is and - as another special case - if (name && namelen == HEf_SVKEY) then name is assumed to contain an SV* and has its REFCNT incremented

(This is now used as a subroutine by sv_magic.)

 
	MAGIC *	sv_magicext(SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen	)  

sv_mortalcopy

Creates a new SV which is a copy of the original SV (using sv_setsv). The new SV is marked as mortal. It will be destroyed "soon", either by an explicit call to FREETMPS, or by an implicit call at places such as statement boundaries. See also sv_newmortal and sv_2mortal.

 
	SV*	sv_mortalcopy(SV* oldsv)  

sv_newmortal

Creates a new null SV which is mortal. The reference count of the SV is set to 1. It will be destroyed "soon", either by an explicit call to FREETMPS, or by an implicit call at places such as statement boundaries. See also sv_mortalcopy and sv_2mortal.

 
	SV*	sv_newmortal()  

sv_newref

Increment an SV's reference count. Use the SvREFCNT_inc() wrapper instead.

 
	SV*	sv_newref(SV* sv)  

sv_nolocking

Dummy routine which "locks" an SV when there is no locking module present. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness.

 
	void	sv_nolocking(SV *)  

sv_nosharing

Dummy routine which "shares" an SV when there is no sharing module present. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness.

 
	void	sv_nosharing(SV *)  

sv_nounlocking

Dummy routine which "unlocks" an SV when there is no locking module present. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness.

 
	void	sv_nounlocking(SV *)  

sv_nv

A private implementation of the SvNVx macro for compilers which can't cope with complex macro expressions. Always use the macro instead.

 
	NV	sv_nv(SV* sv)  

sv_pos_b2u

Converts the value pointed to by offsetp from a count of bytes from the start of the string, to a count of the equivalent number of UTF8 chars. Handles magic and type coercion.

 
	void	sv_pos_b2u(SV* sv, I32* offsetp)  

sv_pos_u2b

Converts the value pointed to by offsetp from a count of UTF8 chars from the start of the string, to a count of the equivalent number of bytes; if lenp is non-zero, it does the same to lenp, but this time starting from the offset, rather than from the start of the string. Handles magic and type coercion.

 
	void	sv_pos_u2b(SV* sv, I32* offsetp, I32* lenp)  
<