#include "perl.h"
#include "XSUB.h"
+HV *_get_namespace(SV *self)
+{
+ dSP;
+ SV *ret;
+
+ PUSHMARK(SP);
+ XPUSHs(self);
+ PUTBACK;
+
+ call_method("namespace", G_SCALAR);
+
+ SPAGAIN;
+ ret = POPs;
+ PUTBACK;
+
+ return (HV*)SvRV(ret);
+}
+
MODULE = Package::Stash PACKAGE = Package::Stash
SV*
RETVAL = slot ? SvREFCNT_inc(*slot) : &PL_sv_undef;
OUTPUT:
RETVAL
+
+void
+remove_package_glob(self, name)
+ SV *self
+ char *name
+ INIT:
+ HV *namespace;
+ CODE:
+ hv_delete(_get_namespace(self), name, strlen(name), G_DISCARD);
Removes all package variables with the given name, regardless of sigil.
-=cut
-
-sub remove_package_glob {
- my ($self, $name) = @_;
- no strict 'refs';
- delete ${$self->name . '::'}{$name};
-}
-
-# ... these functions deal with stuff on the namespace level
-
=method has_package_symbol $variable
Returns whether or not the given package variable (including sigil) exists.