xs/conditionalget.xs

filter: Statementstmt 100% 7 / 7 Branchbran 60.0% 6 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 76.4% 13 / 17 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« include/punk/punk_cachefile.h ↑ Summary include/punk/punk_afterres.h »
1 MODULE = Punk PACKAGE = Punk::Plugin::ConditionalGet
2  
3 PROTOTYPES: DISABLE
4  
5 # register($app, \%opts)
6 #
7 # The plugin is an on-switch and a place for the documentation to live: the
8 # work is the `etag` route option and the check in punk_cget.h, which the
9 # dispatcher runs between a route's guards and its handler.
10 #
11 # It is registered rather than always-on because the option changes what a
12 # request costs and what a client caches, and because a route option that
13 # does something only when a plugin is loaded is the arrangement `sitemap`
14 # already established.
15 void
16 register(self, app, opts = &PL_sv_undef)
17 SV *self
18 SV *app
19 SV *opts
20 CODE:
21 {
22 20 HV *h = app_hv(aTHX_ app);
23 PERL_UNUSED_VAR(self);
24 20 ▶ if (SvOK(opts) && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV) {
Branch: 3 branches
BranchTrueFalseTotal
if (SvOK(opts) && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV) { 20 0 20
if (SvOK(opts) && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV) { 20 0 20
if (SvOK(opts) && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV) { 20 0 20
25 20 HV *o = (HV *)SvRV(opts);
26 HE *he;
27 20 hv_iterinit(o);
28 20 ▶ while ((he = hv_iternext(o)))
Branch: 1 branch
BranchTrueFalseTotal
while ((he = hv_iternext(o))) 1 19 20
29 1 ▶ croak("Punk::Plugin::ConditionalGet: unknown option '%s' - "
Branch: 1 branch
BranchTrueFalseTotal
croak("Punk::Plugin::ConditionalGet: unknown option '%s' - " 0 1 1
30 "there is nothing to configure here; the decision is "
31 "per route, as `etag`", HePV(he, PL_na));
32 }
33 19 (void)hv_stores(h, K_CGET, newSViv(1));
34 }
« include/punk/punk_cachefile.h ↑ Summary include/punk/punk_afterres.h »