Refactor how prehashed hash keys work.
[gitmo/Class-MOP.git] / xs / Attribute.xs
CommitLineData
d846ade3 1#include "mop.h"
2
d846ade3 3MODULE = Class::MOP::Attribute PACKAGE = Class::MOP::Attribute
4
5PROTOTYPES: DISABLE
6
7void
8name(self)
9 SV *self
10 PREINIT:
11 register HE *he;
12 PPCODE:
13 if ( ! SvROK(self) ) {
14 die("Cannot call name as a class method");
15 }
16
22932438 17 if ( (he = hv_fetch_ent((HV *)SvRV(self), KEY_FOR(name), 0, HASH_FOR(name))) )
d846ade3 18 XPUSHs(HeVAL(he));
19 else
20 ST(0) = &PL_sv_undef;