Skip to content

Commit

Permalink
fix warning with oo version of Plack::Builder in development env
Browse files Browse the repository at this point in the history
  • Loading branch information
doy committed Jun 10, 2013
1 parent fae638f commit 4b5041c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Plack/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ sub to_app {
if ($app) {
$self->wrap($app);
} elsif ($self->{_urlmap}) {
$self->{_urlmap} = $self->{_urlmap}->to_app
if Scalar::Util::blessed($self->{_urlmap});
$self->wrap($self->{_urlmap});
} else {
Carp::croak("to_app() is called without mount(). No application to build.");
Expand Down
12 changes: 12 additions & 0 deletions t/Plack-Builder/oo_interface.t
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,16 @@ sub test_app {
like $warn[0], qr/mappings to be ignored/;
}

{
local $ENV{PLACK_ENV} = 'development';
my @warn;
local $SIG{__WARN__} = sub { push @warn, @_ };
my $builder = Plack::Builder->new;
$builder->add_middleware('Runtime');
$builder->add_middleware('XFramework', framework => 'Plack::Builder');
$builder->mount('/app/foo/bar' => $app);
test_app $builder->to_app;
is_deeply(\@warn, [], "no warnings");
}

done_testing;

0 comments on commit 4b5041c

Please sign in to comment.