Morbo issues with Mojolicious 9.34 (change in Mojo/Server.pm)
daleif opened this issue · comments
Lars Madsen commented
- Mojolicious version: 9.34
- Perl version: 5.34
- Operating system: Ubuntu 22.04
Steps to reproduce the behavior
Inspired by the example in #2094
use v5.34;
use Mojolicious::Lite -signatures;
$test;
app->start;
Then run with morbo
Expected behavior
Something like
Web application available at http://127.0.0.1:3000
Can't load application from file "path to script": Global symbol "$test" requires explicit package name (did you forget to declare "my $test"?) at "path to script" line 3.
Compilation failed in require at (eval 93) line 1.
Actual behavior
Instead I get
Web application available at http://127.0.0.1:3000
Can't load application from file "path to script": "path to script" did not return a true value at path/lib/perl5/Mojo/Server.pm line 59.
Which makes debugging ones own mistakes rather hard.
Note that the problem is related to #2097 which changed
my $app = eval "package Mojo::Server::Sandbox::@{[md5_sum $path]}; require \$path";
in Mojo/Server.pm
into
my $app = eval "package Mojo::Server::Sandbox::@{[md5_sum $path]}; do \$path";
(plus some extra checks).
Manually changing do
back into require
makes morbo
behave like normal.
Lars Madsen commented
I'm wondering if it should make sense to run both the do
and the require
version. Such that the latter is run if the first did not return a true value.