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 }
11
11
12
12
# there does not seem to be a relevant RT or perldelta entry for this
13
13
use constant _SPLICE_SAME_ARRAY_SEGFAULT => $] < ' 5.008007' ;
14
+ use constant LOAD_ERROR => " Unknown error. Did you try to load a directory?\n " ;
14
15
15
16
sub load_class {
16
17
my ($class , $prefix ) = @_ ;
@@ -117,11 +118,11 @@ sub _load_sandbox {
117
118
local $0 = $_file; # so FindBin etc. works
118
119
local @ARGV = (); # Some frameworks might try to parse @ARGV
119
120
120
- return eval sprintf <<'END_EVAL' , $_package;
121
+ return eval sprintf <<'END_EVAL' , $_package, LOAD_ERROR ;
121
122
package Plack::Sandbox::%s;
122
123
{
123
124
my $app = do $_file;
124
- if ( !$app && ( my $error = $@ || $! )) { die $error; }
125
+ if ( !$app && ( my $error = $@ || $! || "%s" )) { die $error; }
125
126
$app;
126
127
}
127
128
END_EVAL
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ use Test::More;
45
45
unlike $@ , qr / Died/ ;
46
46
}
47
47
48
+ {
49
+ eval { Plack::Util::load_psgi(" t/Plack-Util/" ) };
50
+ like $@ , qr / Did you try to load a directory/ ;
51
+ }
52
+
48
53
{
49
54
my $app = Plack::Util::load_psgi(" t/Plack-Util/bin/findbin.psgi" );
50
55
test_psgi $app , sub {
You can’t perform that action at this time.
0 commit comments