JiftyX/Markapl/Handler.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 43 CC 2 SCAR 11.5
CC
2
Cov
0%
template_exists
6.0
new
2.0
show
2.0
CRAP 3.1
1 package JiftyX::Markapl::Handler;
2 use strict;
3 use parent qw/Jifty::View/;
4  
5 sub new {
6 my $class = shift;
7 my $self = {};
8 bless $self,$class;
9 my $template_class = Jifty->config->framework("TemplateClass");
10  
11 Jifty->handler->buffer( Markapl->buffer );
12 {
13 my $buffer = Jifty->handler->buffer;
14 no warnings 'redefine';
15 *Jifty::Web::out = sub {shift;unshift @_,$buffer;goto \&String::BufferStack::append};
16 }
17  
18 return $self;
19 }
20  
21 sub show {
22 my $self = shift;
23 my $template = shift;
24 my $template_class = Jifty->config->framework("TemplateClass");
25  
26 $template_class->render($template);
27 Jifty->handler->buffer->clear;
28 return '';
29 }
30  
31 sub template_exists {
32 my $pkg = shift;
33 my $template = shift;
34 my $template_class = Jifty->config->framework("TemplateClass");
35 if ($template_class->can($template)) {
36 return $template;
37 }
38 }
39  
40 1;