File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ sub FALSE() { !TRUE }
1111
1212# there does not seem to be a relevant RT or perldelta entry for this
1313use constant _SPLICE_SAME_ARRAY_SEGFAULT => $] < ' 5.008007' ;
14+ use constant LOAD_ERROR => " Unknown error. Did you try to load a directory?\n " ;
1415
1516sub load_class {
1617 my ($class , $prefix ) = @_ ;
@@ -117,11 +118,11 @@ sub _load_sandbox {
117118 local $0 = $_file; # so FindBin etc. works
118119 local @ARGV = (); # Some frameworks might try to parse @ARGV
119120
120- return eval sprintf <<'END_EVAL' , $_package;
121+ return eval sprintf <<'END_EVAL' , $_package, LOAD_ERROR ;
121122package Plack::Sandbox::%s;
122123{
123124 my $app = do $_file;
124- if ( !$app && ( my $error = $@ || $! )) { die $error; }
125+ if ( !$app && ( my $error = $@ || $! || "%s" )) { die $error; }
125126 $app;
126127}
127128END_EVAL
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ use Test::More;
4545 unlike $@ , qr / Died/ ;
4646}
4747
48+ {
49+ eval { Plack::Util::load_psgi(" t/Plack-Util/" ) };
50+ like $@ , qr / Did you try to load a directory/ ;
51+ }
52+
4853{
4954 my $app = Plack::Util::load_psgi(" t/Plack-Util/bin/findbin.psgi" );
5055 test_psgi $app , sub {
You can’t perform that action at this time.
0 commit comments