Putting aside Apache and Plack topic from my previous email, here is
another issue which I do not understand.
System is OpenBSD 5.0 i386, p5-Plack-0.9980, PSGI app which I'm testing
is p5-Mojolicious-1.99.
I'm starting below PSGIBin ``router'' via plackup as follows:
env -i plackup -r -p 3500 -a /var/www/conf/pl.psgi
------------------------8<------------------------
#!/usr/bin/perl
use warnings;
use strict;
use Plack::App::PSGIBin;
use Plack::Builder;
my $app = Plack::App::PSGIBin->new(root => '/var/www/psgi-bin')->to_app;
builder {
mount '/' => $app;
};
------------------------8<------------------------
I've created very simple Mojolicious::Lite app:
from which the most important part is $self->app->home statement which
detects where the app is placed on the filesystem. At this stage I don't
know is this Plack or Mojolicious issue, but let me explain what I see.
Showing all above, let me go to the problem itself. I have exactly the
same script (above link to pastebin) in three different directories:
# cd /var/www/psgi-bin/
# ls -l tests?/
tests1/:
total 4
-rwxr-xr-x 1 root daemon 1085 Sep 27 22:22 all.pl
tests2/:
total 4
-rwxr-xr-x 1 root daemon 1085 Sep 27 22:22 all.pl
tests3/:
total 4
-rwxr-xr-x 1 root daemon 1085 Sep 27 22:22 all.pl
I'm starting packup (see above how I've executed it) and I'm opening my
browser to hit first all.pl file:
http://www1.kucharski.name:8080/tests1/all.pl
all is good, look at the ``home'' value, which correctly states
``/var/www/psgi-bin/tests1'', now lets hit another file:
http://www1.kucharski.name:8080/tests2/all.pl
and look at ``home'', then again go to:
http://www1.kucharski.name:8080/tests3/all.pl
You can see that ``home'' did *not* change when it should. This is my
issues. I'm learing Mojolicious and PSGIBin works perfectly (well,
should anyway) for me as I can put bunch of testing script to a
directories and see how they work, but ``app->home'' doesn't work as you
can see above.
- Can you advice where the problem can be?
- Do you think it's Plack or Mojolicious issue?
Cheers.
PS. Firewall does DNAT from port 8080 to my DMZ where plackup is
running on port 3500.
--
best regards
q#
--
best regards
q#
> You can see that ``home'' did *not* change when it should. This is my
> issues. I'm learing Mojolicious and PSGIBin works perfectly (well,
> should anyway) for me as I can put bunch of testing script to a
> directories and see how they work, but ``app->home'' doesn't work as you
> can see above.
I do understand the motivation but the way Mojolicious::Lite creates
namespaces and caches inside %ENV global variable, it doesn't work
nicely with multiple app environment like URLMap and PSGIBin.
> - Can you advice where the problem can be?
>
> - Do you think it's Plack or Mojolicious issue?
Look at the Mojolicious::Lite source code and you can easily locate
the use of %ENV.
--
Tatsuhiko Miyagawa
Just so I can be sure, do you mean line number 15?
https://metacpan.org/source/SRI/Mojolicious-2.15/lib/Mojolicious/Lite.pm#L15
--
best regards
q#
Yep, and other MOJO_ environment variables assume that there is only one Mojolicious application per Perl interpreter.