Skip to content

Commit

Permalink
enable Lint middleware by default in the development env
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Apr 19, 2010
1 parent c10d77d commit ff298a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/Plack/Runner.pm
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,20 @@ sub watch {
if $self->{loader} eq 'Restarter';
}

sub apply_middleware {
my($self, $app, $class, @args) = @_;

my $mw_class = Plack::Util::load_class($class, 'Plack::Middleware');
build { $mw_class->wrap($_[0], @args) } $app;
}

sub prepare_devel {
my($self, $app) = @_;

require Plack::Middleware::StackTrace;
require Plack::Middleware::AccessLog;
$app = build { Plack::Middleware::StackTrace->wrap($_[0]) } $app;
$app = $self->apply_middleware($app, 'Lint');
$app = $self->apply_middleware($app, 'StackTrace');
unless ($ENV{GATEWAY_INTERFACE}) {
$app = build { Plack::Middleware::AccessLog->wrap($_[0], logger => sub { print STDERR @_ }) } $app;
$app = $self->apply_middleware($app, 'AccessLog', logger => sub { print STDERR @_ });
}

push @{$self->{options}}, server_ready => sub {
Expand Down

0 comments on commit ff298a3

Please sign in to comment.