Commit | Line | Data |
---|---|---|
d846ade3 | 1 | #include "mop.h" |
2 | ||
d846ade3 | 3 | MODULE = Class::MOP::Attribute PACKAGE = Class::MOP::Attribute |
4 | ||
5 | PROTOTYPES: DISABLE | |
6 | ||
7 | void | |
8 | name(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; |