| 1 |
|
| MODULE = Punk PACKAGE = Punk |
| 2 |
|
| |
| 3 |
|
| PROTOTYPES: DISABLE |
| 4 |
|
| |
| 5 |
|
| # The request dispatcher (punk_serve.h). compile() freezes the routing state |
| 6 |
|
| # and returns sub { Punk::_serve($state, $env) }: static/dynamic routing, the |
| 7 |
|
| # API-mount route+dispatch, PSGI mounts, 404/405, and for a web route the |
| 8 |
|
| # before hooks, guards, controller (or websocket upgrade) and response finish - |
| 9 |
|
| # all in C. Only the hooks/guards/controllers/mounts are Perl frames. |
| 10 |
|
| SV * |
| 11 |
|
| # uncoverable statement |
| 12 |
|
| # uncoverable subroutine |
| 13 |
|
| _serve(state, env) |
| 14 |
|
| SV *state |
| 15 |
|
| SV *env |
| 16 |
|
| CODE: |
| 17 |
|
| { |
| 18 |
0 |
▶ | # uncoverable statement |
Branch: 2 branches
| Branch | True | False | Total |
| # uncoverable statement |
0 |
0 |
0 |
| # uncoverable statement |
0 |
0 |
0 |
|
| 19 |
0 |
| # uncoverable branch true |
| 20 |
0 |
▶ | # uncoverable branch false |
Branch: 2 branches
| Branch | True | False | Total |
| # uncoverable branch false |
0 |
0 |
0 |
| # uncoverable branch false |
0 |
0 |
0 |
|
| 21 |
0 |
| # uncoverable condition left count:1 |
| 22 |
|
| # uncoverable condition right count:1 |
| 23 |
0 |
| # uncoverable condition left count:2 |
| 24 |
0 |
| # uncoverable condition right count:2 |
| 25 |
|
| if (!SvROK(state) || SvTYPE(SvRV(state)) != SVt_PVHV) |
| 26 |
|
| croak("Punk::_serve: state must be a hashref"); /* # uncoverable statement */ |
| 27 |
|
| # uncoverable statement |
| 28 |
|
| # uncoverable branch true |
| 29 |
|
| # uncoverable branch false |
| 30 |
|
| # uncoverable condition left count:1 |
| 31 |
|
| # uncoverable condition right count:1 |
| 32 |
|
| # uncoverable condition left count:2 |
| 33 |
|
| # uncoverable condition right count:2 |
| 34 |
|
| if (!SvROK(env) || SvTYPE(SvRV(env)) != SVt_PVHV) |
| 35 |
|
| croak("Punk::_serve: env must be a hashref"); /* # uncoverable statement */ |
| 36 |
|
| { /* the struct the app closure carries, built for this one call */ |
| 37 |
|
| SV *holder = sv_2mortal(pk_state_build(aTHX_ (HV *)SvRV(state))); /* # uncoverable statement */ |
| 38 |
|
| RETVAL = punk_serve(aTHX_ pk_state_of(aTHX_ holder), (HV *)SvRV(env)); /* # uncoverable statement */ |
| 39 |
|
| } |
| 40 |
|
| } |
| 41 |
|
| OUTPUT: |
| 42 |
|
| RETVAL |