Skip to content

Commit

Permalink
server: use to_app
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Aug 14, 2016
1 parent 754782c commit 29bc33e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app.psgi
Expand Up @@ -4,6 +4,7 @@ use warnings;
use FindBin;
use lib "$FindBin::RealBin/lib";
use Catalyst::Middleware::Stash 'stash';
use MetaCPAN::Server;

if ( $ENV{PLACK_ENV} eq 'development' ) {

Expand All @@ -14,5 +15,5 @@ if ( $ENV{PLACK_ENV} eq 'development' ) {
}
}

# The class has the Plack initialization and returns the app.
require MetaCPAN::Server;
MetaCPAN::Server->to_app;

5 changes: 3 additions & 2 deletions lib/MetaCPAN/Server.pm
Expand Up @@ -117,5 +117,6 @@ sub to_app {
return $app;
}

# Let's be explicit because implicit returns can be confusing
return $app;
1;

__END__
3 changes: 2 additions & 1 deletion t/lib/MetaCPAN/Server/Test.pm
Expand Up @@ -6,6 +6,7 @@ use warnings;
use HTTP::Request::Common qw(POST GET DELETE);
use Plack::Test;
use Test::More;
use MetaCPAN::Server;

use base 'Exporter';
our @EXPORT = qw(
Expand All @@ -21,7 +22,7 @@ my $app;
sub _load_app {

# Delay loading.
$app ||= require MetaCPAN::Server;
$app ||= MetaCPAN::Server->to_app;
}

sub prepare_user_test_data {
Expand Down

0 comments on commit 29bc33e

Please sign in to comment.