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