From: Matt S Trout Date: Sat, 20 Jul 2013 17:44:12 +0000 (+0000) Subject: enable SSI X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb6a4cecc89e164112ee6e559f3abd63ec9bc7b3;p=scpubgit%2FApp-SCS.git enable SSI --- diff --git a/lib/App/SCS/Plugin/Generate/StaticServer.pm b/lib/App/SCS/Plugin/Generate/StaticServer.pm index e31b773..bdb3ec1 100644 --- a/lib/App/SCS/Plugin/Generate/StaticServer.pm +++ b/lib/App/SCS/Plugin/Generate/StaticServer.pm @@ -16,17 +16,20 @@ sub _build__dir_handler { ); } -has _static_handler => (is => 'lazy'); - -sub _build__static_handler { +has _static_handler => (is => 'lazy', builder => sub { my ($self) = @_; use_module('Plack::App::File')->new( root => $self->app->share_dir->catdir('static') ); -} +}); + +has _ssi_handler => (is => 'lazy', builder => sub { + use_module('Plack::Middleware::SSI')->new +}); sub dispatch_request { my ($self) = @_; + sub { $self->_ssi_handler }, sub (/**.*) { my $path = $_[1]; return unless $path =~ s/(?=\/|^)-//; diff --git a/lib/App/SCS/Plugin/Server.pm b/lib/App/SCS/Plugin/Server.pm index 5759c5f..bb87f75 100644 --- a/lib/App/SCS/Plugin/Server.pm +++ b/lib/App/SCS/Plugin/Server.pm @@ -31,7 +31,9 @@ sub run_command_server { my @args = @{$env->{argv}}; my $r = use_module('Plack::Runner')->new( server => 'Starman', - app => $self->app->web->to_psgi_app + app => use_module('Plack::Middleware::SSI')->wrap( + $self->app->web->to_psgi_app + ) ); $r->parse_options(@args); $r->set_options(argv => \@args);