Skip to content

Morbo issues with Mojolicious 9.34 (change in Mojo/Server.pm) #2110

@daleif

Description

@daleif
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions