examples/app.psgi

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Plack/Middleware/JSON/ForBrowsers.pm ↑ Summary
1 #!/usr/bin/env plackup
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Plack::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶my $json_app = sub { return [
Subroutine __ANON__: called CC=1 SCAR=0.0
10 3 200,
11 [ 'Content-Type' => 'application/json' ],
12 [ encode('UTF-8', "{\"foo\":\"bar, \x{263a}, \x{fc}\",\"<h1>baz</h1>\":2}") ]
13 1 ] };
14  
15 1 ▶my $other_app = sub { return [
Subroutine __ANON__: called CC=1 SCAR=0.0
16 1 200,
17 [ 'Content-Type' => 'text/plain' ],
18 [ 'Hello, world!' ]
19 1 ] };
20  
21 1 ▶my $app = builder {
Subroutine __ANON__: called CC=1 SCAR=0.0
22 1 enable 'JSON::ForBrowsers';
23 1 mount '/json' => $json_app;
24 1 mount '/other' => $other_app;
25 1 };
« blib/lib/Plack/Middleware/JSON/ForBrowsers.pm ↑ Summary