Having the next simple Plack app:
use strict;
use warnings;
use Plack::Builder;
my $app = sub {
return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];
};
builder {
foreach my $act ( qw( /some/aa /another/bb / ) ) {
mount $act => $app;
}
};
return's error:
WARNING: You used mount() in a builder block, but the last line (app) isn't using mount().
WARNING: This causes all mount() mappings to be ignored.
at /private/tmp/test.psgi line 13.
Error while loading /private/tmp/test.psgi: to_app() is called without mount(). No application to build. at /private/tmp/test.psgi line 13.
but the next builder block is OK.
builder {
foreach my $act ( qw( /some/aa /another/bb / ) ) {
mount $act => $app;
}
mount "/" => $app;
};
I understand than the Plack::Builder manual says
NOTE: Once you use mount in your builder code, you have to use mount for all the paths, including the root path (/).
But in the for
loop i have the /
mount as last one: qw( /some/aa /another/bb / )
, so something is here behind the scene.
Can anybody explain, please?