Scalar::Util#
General-utility subroutines for inspecting and tagging scalar values.
Functions#
Other Functions#
reftype#
reftype($ref) - returns type string without blessing.
tainted#
ListUtil.xs tainted(sv) - true iff the argument carries PERL_MAGIC_taint (set by perl5’s taint-source machinery under -T; ${^TAINT} is live in pperl and %ENV/@ARGV/$0/file reads propagate SvTAINTED normally). int RETVAL returns via the entersub TARG (the typemap’s dXSTARG/PUSHi) - see xs_readonly for why.
readonly#
ListUtil.xs readonly(sv) - int RETVAL = SvREADONLY(sv) after get-magic. RETVAL is the raw flag word (SVf_READONLY|SVf_PROTECT), not a normalized bool - perl5 returns e.g. 134283264 and callers can observe it. Returning through the TARG matters beyond faithfulness: pushing &PL_sv_yes/no makes the caller’s lvalue COW-static, so every later assignment to it pays a sv_force_normal/uncow round-trip (measured 0.66x perl5).
set_prototype#
set_prototype(\&sub, $proto) - Scalar::Util calling convention (&$). perl5 ListUtil.xs set_prototype() (Sub::Util section): cv = SvRV(code); SvTYPE(cv) == SVt_PVCV or croak. SvPOK(proto) → sv_copypv(cv, proto) else SvPOK_off(cv) Scalar::Util wrapper reverses args: (&code, $proto) → set_prototype($proto, $code). We implement the Scalar::Util convention directly: arg0=coderef, arg1=proto.