/* yes, this is C code... specifically, this is XS code! this is japhy's first XS work! it implements curse(), which takes an object and makes it not an object. */ #ifdef __cplusplus extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus } #endif MODULE = Scalar::Curse PACKAGE = Scalar::Curse int curse(obj) SV *obj CODE: if (SvOBJECT(SvRV(obj))) { SvOBJECT_off(SvRV(obj)); SvSTASH(SvRV(obj)) = NULL; RETVAL = 1; } else { RETVAL = 0; } OUTPUT: RETVAL
In reply to From a Blessing to a Curse by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |