blib/lib/auto/share/dist/Amon2/flavor/Basic/lib/__PATH__/Web.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 51 CC 1 SCAR 6.9
CC
1
Cov
0%
dispatch
2.0
create_view
2.0
BEGIN
2.0
CRAP 2.0
1 package <% $module %>::Web;
2 use strict;
3 use warnings;
4 use utf8;
5 use parent qw/<% $module %> Amon2::Web/;
6 use File::Spec;
7  
8 # dispatcher
9 use <% $module %>::Web::Dispatcher;
10 sub dispatch {
11 return (<% $module %>::Web::Dispatcher->dispatch($_[0]) or die "response is not generated");
12 }
13  
14 # load plugins
15 __PACKAGE__->load_plugins(
16 'Web::FillInFormLite',
17 'Web::JSON',
18 '+<% $module %>::Web::Plugin::Session',
19 );
20  
21 # setup view
22 use <% $module %>::Web::View;
23 {
24 sub create_view {
25 my $view = <% $module %>::Web::View->make_instance(__PACKAGE__);
26 no warnings 'redefine';
27 *<% $module %>::Web::create_view = sub { $view }; # Class cache.
28 $view
29 }
30 }
31  
32 # for your security
33 __PACKAGE__->add_trigger(
34 AFTER_DISPATCH => sub {
35 my ( $c, $res ) = @_;
36  
37 # http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
38 $res->header( 'X-Content-Type-Options' => 'nosniff' );
39  
40 # http://blog.mozilla.com/security/2010/09/08/x-frame-options/
41 $res->header( 'X-Frame-Options' => 'DENY' );
42  
43 # Cache control.
44 $res->header( 'Cache-Control' => 'private' );
45 },
46 );
47  
48 1;