```{index} single: Scalar::Util; Perl module ``` # Scalar::Util ```{pperl-module-badges} Scalar::Util ``` General-utility subroutines for inspecting and tagging scalar values. ## Functions ### Other Functions #### `blessed` `blessed($ref)` — returns class name if blessed, undef otherwise. #### `reftype` `reftype($ref)` — returns type string without blessing. #### `tainted` `tainted($sv)` — mirrors Scalar-Util-1.68/Util.xs tainted(). Returns true iff the argument carries PERL_MAGIC_taint (set by perl5's taint-source machinery when running under -T). The earlier stub hardcoded false under the false assumption that pperl has no taint mode; we do — ${^TAINT} is live and sources (`%ENV`, `@ARGV`, $0, file reads) propagate SvTAINTED normally. #### `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.