File Coverage

examples/app.psgi
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/env plackup
2              
3 1     1   1150 use strict;
  1         2  
  1         27  
4 1     1   5 use warnings;
  1         1  
  1         26  
5              
6 1     1   686 use Plack::Builder;
  1         6257  
  1         97  
7 1     1   9 use Encode;
  1         2  
  1         245  
8              
9             my $json_app = sub { return [
10             200,
11             [ 'Content-Type' => 'application/json' ],
12             [ encode('UTF-8', "{\"foo\":\"bar, \x{263a}, \x{fc}\",\"

baz

\":2}") ]
13             ] };
14              
15             my $other_app = sub { return [
16             200,
17             [ 'Content-Type' => 'text/plain' ],
18             [ 'Hello, world!' ]
19             ] };
20              
21             my $app = builder {
22             enable 'JSON::ForBrowsers';
23             mount '/json' => $json_app;
24             mount '/other' => $other_app;
25             };