File Coverage

t/parts.xs
Criterion Covered Total %
statement 14 14 100.0
branch 8 8 100.0
condition n/a
subroutine n/a
pod n/a
total 22 22 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             .ver = XSPARSESUBLIKE_ABI_VERSION,
17             .permit = parts_permit,
18             };
19              
20 10           static bool parts_permit(pTHX_ void *_)
21             {
22 10           parse_parts_hooks.require_parts = 0;
23 10           parse_parts_hooks.skip_parts = 0;
24              
25 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/require-name", 0))
26 1           parse_parts_hooks.require_parts |= XS_PARSE_SUBLIKE_PART_NAME;
27 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-name", 0))
28 1           parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_NAME;
29              
30 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-attrs", 0))
31 1           parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_ATTRS;
32              
33 10 100         if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-signature", 0))
34 1           parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_SIGNATURE;
35              
36 10           return TRUE;
37             }
38              
39             MODULE = t::parts PACKAGE = t::parts
40              
41             BOOT:
42 3           boot_xs_parse_sublike(0);
43              
44 3           register_xs_parse_sublike("parts", &parse_parts_hooks, NULL);