Make it easier to simple xs hashref readers using prehashed keys.
[gitmo/Class-MOP.git] / xs / Attribute.xs
index 150fd05..0375cb4 100644 (file)
@@ -4,17 +4,5 @@ MODULE = Class::MOP::Attribute   PACKAGE = Class::MOP::Attribute
 
 PROTOTYPES: DISABLE
 
-void
-name(self)
-    SV *self
-    PREINIT:
-        register HE *he;
-    PPCODE:
-        if ( ! SvROK(self) ) {
-            die("Cannot call name as a class method");
-        }
-
-        if ( (he = hv_fetch_ent((HV *)SvRV(self), KEY_FOR(name), 0, HASH_FOR(name))) )
-            XPUSHs(HeVAL(he));
-        else
-            ST(0) = &PL_sv_undef;
+BOOT:
+    INSTALL_SIMPLE_READER(Attribute, name);