File Coverage

t/parts.xs
Criterion Covered Total %
statement 13 13 100.0
branch 8 8 100.0
condition n/a
subroutine n/a
pod n/a
total 21 21 100.0


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, 2020 -- leonerd@leonerd.org.uk
5             */
6              
7             #include "EXTERN.h"
8             #include "perl.h"
9             #include "XSUB.h"
10              
11             #include "XSParseSublike.h"
12              
13             static bool parts_permit(pTHX_ void *_);
14              
15             static struct XSParseSublikeHooks parse_parts_hooks = {
16             .permit = parts_permit,
17             };
18              
19 10           static bool parts_permit(pTHX_ void *_)
20             {
21 10           parse_parts_hooks.require_parts = 0;
22 10           parse_parts_hooks.skip_parts = 0;
23              
24 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/require-name", 0))
25 1           parse_parts_hooks.require_parts |= XS_PARSE_SUBLIKE_PART_NAME;
26 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-name", 0))
27 1           parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_NAME;
28              
29 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-attrs", 0))
30 1           parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_ATTRS;
31              
32 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-signature", 0))
33 1           parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_SIGNATURE;
34              
35 10           return TRUE;
36             }
37              
38             MODULE = t::parts PACKAGE = t::parts
39              
40             BOOT:
41 3           boot_xs_parse_sublike(0);
42              
43             register_xs_parse_sublike("parts", &parse_parts_hooks, NULL);