| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* You may distribute under the terms of either the GNU General Public License |
|
2
|
|
|
|
|
|
|
* or the Artistic License (the same terms as Perl itself) |
|
3
|
|
|
|
|
|
|
* |
|
4
|
|
|
|
|
|
|
* (C) Paul Evans, 2021-2022 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
*/ |
|
6
|
|
|
|
|
|
|
#define PERL_NO_GET_CONTEXT |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
9
|
|
|
|
|
|
|
#include "perl.h" |
|
10
|
|
|
|
|
|
|
#include "XSUB.h" |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#include "object_pad.h" |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
|
static bool struct_apply(pTHX_ ClassMeta *classmeta, SV *hookdata, SV **hookdata_ptr, void *_funcdata) |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
1
|
|
|
|
|
|
mop_class_apply_attribute(classmeta, "strict", sv_2mortal(newSVpvs("params"))); |
|
17
|
1
|
|
|
|
|
|
return TRUE; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
|
static void struct_post_add_field(pTHX_ ClassMeta *classmeta, SV *hookdata, void *_funcdata, FieldMeta *fieldmeta) |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
3
|
50
|
|
|
|
|
if(mop_field_get_sigil(fieldmeta) != '$') |
|
23
|
|
|
|
|
|
|
return; |
|
24
|
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
|
mop_field_apply_attribute(fieldmeta, "param", NULL); |
|
26
|
3
|
|
|
|
|
|
mop_field_apply_attribute(fieldmeta, "mutator", NULL); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
static const struct ClassHookFuncs struct_hooks = { |
|
30
|
|
|
|
|
|
|
.ver = OBJECTPAD_ABIVERSION, |
|
31
|
|
|
|
|
|
|
.flags = OBJECTPAD_FLAG_ATTR_NO_VALUE, |
|
32
|
|
|
|
|
|
|
.permit_hintkey = "Object::Pad::ClassAttr::Struct/Struct", |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
.apply = &struct_apply, |
|
35
|
|
|
|
|
|
|
.post_add_field = &struct_post_add_field, |
|
36
|
|
|
|
|
|
|
}; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MODULE = Object::Pad::ClassAttr::Struct PACKAGE = Object::Pad::ClassAttr::Struct |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
BOOT: |
|
41
|
2
|
|
|
|
|
|
register_class_attribute("Struct", &struct_hooks, NULL); |