Commit | Line | Data |
d846ade3 |
1 | #include "mop.h" |
2 | |
3 | NEEDS_KEY(name); |
4 | NEEDS_KEY(body); |
5 | NEEDS_KEY(package_name); |
6 | |
7 | MODULE = Class::MOP::Method PACKAGE = Class::MOP::Method |
8 | |
9 | PROTOTYPES: DISABLE |
10 | |
11 | void |
12 | name(self) |
13 | SV *self |
14 | PREINIT: |
15 | register HE *he; |
16 | PPCODE: |
17 | if ( ! SvROK(self) ) { |
18 | die("Cannot call name as a class method"); |
19 | } |
20 | |
21 | if ( (he = hv_fetch_ent((HV *)SvRV(self), key_name, 0, hash_name)) ) |
22 | XPUSHs(HeVAL(he)); |
23 | else |
24 | ST(0) = &PL_sv_undef; |
25 | |
26 | void |
27 | package_name(self) |
28 | SV *self |
29 | PREINIT: |
30 | register HE *he; |
31 | PPCODE: |
32 | if ( ! SvROK(self) ) { |
33 | die("Cannot call package_name as a class method"); |
34 | } |
35 | |
36 | if ( (he = hv_fetch_ent((HV *)SvRV(self), key_package_name, 0, hash_package_name)) ) |
37 | XPUSHs(HeVAL(he)); |
38 | else |
39 | ST(0) = &PL_sv_undef; |
40 | |
41 | void |
42 | body(self) |
43 | SV *self |
44 | PREINIT: |
45 | register HE *he; |
46 | PPCODE: |
47 | if ( ! SvROK(self) ) { |
48 | die("Cannot call body as a class method"); |
49 | } |
50 | |
51 | if ( (he = hv_fetch_ent((HV *)SvRV(self), key_body, 0, hash_body)) ) |
52 | XPUSHs(HeVAL(he)); |
53 | else |
54 | ST(0) = &PL_sv_undef; |