File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,11 @@ sub load_app {
5454 local @ARGS_OVERRIDE = @args ;
5555
5656 # Try to load application from script into sandbox
57- my $app = eval " package Mojo::Server::Sandbox::@{[md5_sum $path ]}; do \$ path" ;
58- my $err = $app ? undef : $@ || $! || " $path did not return a true value" ;
59- die qq{ Can't load application from file "$path ": $err } if $err ;
57+ my $app = eval sprintf <<'END_CODE' , md5_sum($path );
58+ package Mojo::Server::Sandbox::%s;
59+ do $path or die $@ || $! || "$path did not return a true value";
60+ END_CODE
61+ die qq{ Can't load application from file "$path ": $@ } if $@ ;
6062 die qq{ File "$path " did not return an application object.\n } unless blessed $app && $app -> can(' handler' );
6163 $self -> app($app );
6264 };
Original file line number Diff line number Diff line change @@ -88,7 +88,8 @@ subtest 'Load broken app' => sub {
8888 eval { Mojo::Server::Daemon-> new-> load_app(" $bin /lib/Mojo/LoaderTest/A.pm" ) };
8989 like $@ , qr / did not return an application object/ , ' right error' ;
9090 eval { Mojo::Server::Daemon-> new-> load_app(" $bin /lib/Mojo/LoaderException.pm" ) };
91- like $@ , qr / ^Can't load application/ , ' right error' ;
91+ like $@ , qr / Missing right curly or square bracket/ , ' right error' ;
92+ like $@ , qr / ^Can't load application/ , ' right error' ;
9293};
9394
9495subtest ' Load app using module_true' => sub {
You can’t perform that action at this time.
0 commit comments