App/Presenter/AsIs.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 34 CC 3 SCAR 18.4
CC
3
Cov
0%
process
12.0
headers
2.0
wrap_log
2.0
CRAP 6.3
1 package Web::App::Presenter::AsIs;
2  
3 use Class::Easy;
4  
5 use base qw(Web::App::Presenter);
6  
7 sub headers {
8 my $app = Web::App->app;
9 my $headers = $app->response->headers;
10 $headers->header ('Cache-Control' => 'no-store');
11 }
12  
13 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
14 sub process {
15 my $self = shift;
16 my $app = shift;
17 my $data = shift;
18 my %params = @_;
19
20 critical "can't use whole stash, please use var parameter"
21 unless $params{var};
22
23 if ($params{content_type}) {
24 my $headers = $app->response->headers;
25 $headers->header ('Content-Type' => $params{content_type});
26 } else {
27 critical "you must define content_type parameter for this presenter";
28 }
29
30 return $data->{$params{var}};
31 }
32 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
33 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
34 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
35  
36 sub wrap_log {
37 my $self = shift;
38 my $content = shift;
39
40 return join '', "\n<!--\n", $content, "\n-->\n";
41 }
42  
43  
44 1;
45