examples/utf8-echo/app.pl

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 17 / 17 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« examples/strong-params-deep/app.pl ↑ Summary examples/websocket-echo/app.pl »
1 1 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use PAGI::Nano;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # Ports PAGI's 12-utf8 to PAGI::Nano.
6 # UTF-8 round-trips across the input vectors: the path segment (already decoded
7 # by PAGI) and the query string. Nano's JSON coercion encodes UTF-8 for you.
8 #
9 # pagi-server app.pl
10 # curl http://127.0.0.1:5000/echo/héllo
11 # curl 'http://127.0.0.1:5000/echo/x?text=naïve'
12  
13 1 ▶my $app = app {
Subroutine __ANON__: called CC=1 SCAR=0.0
14 1 ▶ get '/echo/:word' => sub ($c, $word) {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 {
16 1 from_path => $word, # decoded by PAGI
17 from_query => $c->req->query_param('text'), # decoded by Request
18 length => length($word), # characters, not bytes
19 };
20 1 };
21 1 };
22  
23 1 $app;
« examples/strong-params-deep/app.pl ↑ Summary examples/websocket-echo/app.pl »