Permalink
Browse files

Move to_app auto promotion to Builder instead of load_psgi

  • Loading branch information...
1 parent b2455e1 commit ec6d32c91c5409ea44b7be212b4b404c4a66b59e @miyagawa miyagawa committed Feb 8, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −0 lib/Plack/Builder.pm
  2. +0 −1 lib/Plack/Util.pm
View
3 lib/Plack/Builder.pm
@@ -6,6 +6,7 @@ our @EXPORT = qw( builder add enable enable_if mount );
use Carp ();
use Plack::App::URLMap;
use Plack::Middleware::Conditional; # TODO delayed load?
+use Scalar::Util ();
sub new {
my $class = shift;
@@ -123,6 +124,8 @@ sub builder(&) {
}
}
+ $app = $app->to_app if $app and Scalar::Util::blessed($app) and $app->can('to_app');
+
$self->to_app($app);
}
View
1 lib/Plack/Util.pm
@@ -133,7 +133,6 @@ sub load_psgi {
my $app = _load_sandbox($file);
die "Error while loading $file: $@" if $@;
- return $app->to_app if $app and Scalar::Util::blessed($app) and $app->can('to_app');
return $app;
}

0 comments on commit ec6d32c

Please sign in to comment.