blib/lib/Plack/App/JSP.pm

filter: Statementstmt 84.6% 11 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 88.8% 16 / 18 CC 1 SCAR 0.6
CC
1
Cov
85%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 #
2 # This file is part of Plack-App-JSP
3 #
4 # This software is copyright (c) 2010 by Patrick Donelan <pat@patspam.com>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 package Plack::App::JSP;
10 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $Plack::App::JSP::VERSION = '0.101680';
12 }
13 # ABSTRACT: Javascript PSGI apps via JSP
14  
15 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use parent qw(Plack::Component);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Plack::Util::Accessor qw(js ctx);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 0 ▶use JSP;
Subroutine BEGIN: called CC=1 SCAR=2.6
19  
20 sub prepare_app {
21 my $self = shift;
22 $self->ctx( JSP->stock_context );
23 }
24  
25 sub call {
26 my ( $self, $env ) = @_;
27 my $res = $self->ctx->eval( $self->js );
28 $res->[2] = [ map Encode::encode( 'utf8', $_ ), @{ $res->[2] } ]
29 if ref $res->[2] eq 'ARRAY';
30 return $res;
31 }
32  
33 1;
34  
35  
36 __END__
↑ Summary