File Coverage

blib/lib/Plack/App/Data/Printer.pm
Criterion Covered Total %
statement 27 27 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package Plack::App::Data::Printer;
2              
3 3     3   85861 use base qw(Plack::Component);
  3         18  
  3         1162  
4 3     3   30663 use strict;
  3         6  
  3         46  
5 3     3   11 use warnings;
  3         4  
  3         57  
6              
7 3     3   1365 use Data::Printer;
  3         76902  
  3         17  
8 3     3   2546 use Error::Pure qw(err);
  3         24708  
  3         47  
9 3     3   1244 use Plack::Util::Accessor qw(data);
  3         743  
  3         17  
10              
11             our $VERSION = 0.02;
12              
13             sub call {
14 1     1 1 10 my ($self, $env) = @_;
15              
16 1         2 my $output;
17 1         4 my $data = $self->data;
18 1         8 p $data, 'output' => \$output;
19              
20             return [
21 1         5680 200,
22             ['Content-Type' => 'text/plain'],
23             [$output],
24             ];
25             }
26              
27             sub prepare_app {
28 2     2 1 20886 my $self = shift;
29              
30 2 100       5 if (! $self->data) {
31 1         7 err 'No data.';
32             }
33              
34 1         7 return;
35             }
36              
37             1;
38              
39             __END__