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