/* 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: From a Blessing to a Curse
by bikeNomad (Priest) on Jul 15, 2001 at 01:58 UTC | |
by japhy (Canon) on Jul 15, 2001 at 02:02 UTC | |
|
Re: From a Blessing to a Curse
by dragonchild (Archbishop) on Sep 06, 2001 at 22:57 UTC |