@@ -27,7 +27,7 @@ for my $file ($nonfile, ' ') {
27
27
require $file ;
28
28
};
29
29
30
- like $@ , qr / ^Can't locate $file in \@ INC \(\@ INC contains : \Q @INC \E\) at/ ,
30
+ like $@ , qr / ^Can't locate $file in \@ INC \(\@ INC[ \w ]+ : \Q @INC \E\) at/ ,
31
31
" correct error message for require '$file '" ;
32
32
}
33
33
@@ -91,7 +91,7 @@ for my $file ($nonfile, ' ') {
91
91
$hint =~ s /\. pm$// ;
92
92
$exp .= " (you may need to install the $hint module)" ;
93
93
}
94
- $exp .= " (\@ INC contains : @INC ) at" ;
94
+ $exp .= " (\@ INC entries checked : @INC ) at" ;
95
95
}
96
96
else {
97
97
# undef implies a require which doesn't compile,
@@ -139,14 +139,14 @@ eval {
139
139
require " $nonfile .ph" ;
140
140
};
141
141
142
- like $@ , qr / ^Can't locate $nonfile \. ph in \@ INC \( did you run h2ph\?\) \(\@ INC contains : @INC \) at/ ;
142
+ like $@ , qr / ^Can't locate $nonfile \. ph in \@ INC \( did you run h2ph\?\) \(\@ INC[ \w ]+ : @INC \) at/ ;
143
143
144
144
for my $file (" $nonfile .h" , " .h" ) {
145
145
eval {
146
146
require $file
147
147
};
148
148
149
- like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( change \. h to \. ph maybe\?\) \( did you run h2ph\?\) \(\@ INC contains : @INC \) at/ ,
149
+ like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( change \. h to \. ph maybe\?\) \( did you run h2ph\?\) \(\@ INC[ \w ]+ : @INC \) at/ ,
150
150
" correct error message for require '$file '" ;
151
151
}
152
152
@@ -155,7 +155,7 @@ for my $file ("$nonfile.ph", ".ph") {
155
155
require $file
156
156
};
157
157
158
- like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( did you run h2ph\?\) \(\@ INC contains : @INC \) at/ ,
158
+ like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( did you run h2ph\?\) \(\@ INC[ \w ]+ : @INC \) at/ ,
159
159
" correct error message for require '$file '" ;
160
160
}
161
161
@@ -311,24 +311,22 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
311
311
{ }, ' Inc hooks have the correct cop_file' );
312
312
}
313
313
{
314
- local $: :TODO = " Pending segfault fix" ;
315
314
# this can segfault or assert prior to @INC hardening.
316
315
fresh_perl_like(
317
316
' unshift @INC, sub { *INC=["a","b"] }; '
318
317
.' eval "require Frobnitz" or print $@' ,
319
- qr !\(\@ INC contains : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
318
+ qr !\(\@ INC[ \w ]+ : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
320
319
{ }, ' INC hooks do not segfault when overwritten' );
321
320
}
322
321
{
323
- local $: :TODO = " Pending error message improvement" ;
324
322
# this is the defined behavior, but in older perls the error message
325
323
# would lie and say "contains: a b", which is true in the sense that
326
324
# it is the value of @INC after the require, but not the directory
327
325
# list that was looked at.
328
326
fresh_perl_like(
329
327
' @INC = (sub { @INC=("a","b"); () }, "z"); '
330
328
.' eval "require Frobnitz" or print $@' ,
331
- qr !\(\@ INC contains : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
329
+ qr !\(\@ INC[ \w ]+ : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
332
330
{ }, ' INC hooks that overwrite @INC continue as expected (skips a and z)' );
333
331
}
334
332
{
@@ -337,7 +335,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
337
335
fresh_perl_like(
338
336
' @INC = (sub { @INC=qw(a b); undef $INC }, "z"); '
339
337
.' eval "require Frobnitz" or print $@' ,
340
- qr !\(\@ INC contains : CODE\( 0x[A-Fa-f0-9]+\) a b\) ! ,
338
+ qr !\(\@ INC[ \w ]+ : CODE\( 0x[A-Fa-f0-9]+\) a b\) ! ,
341
339
{ }, ' INC hooks that overwrite @INC and undef $INC continue at start' );
342
340
}
343
341
{
@@ -347,7 +345,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
347
345
' sub CB::INCDIR { return "b", "c","d" }; '
348
346
.' @INC = ("a",bless({},"CB"),"e");'
349
347
.' eval "require Frobnitz" or print $@' ,
350
- qr !\(\@ INC contains : a CB=HASH\( 0x[A-Fa-f0-9]+\) b c d e\) ! ,
348
+ qr !\(\@ INC[ \w ]+ : a CB=HASH\( 0x[A-Fa-f0-9]+\) b c d e\) ! ,
351
349
{ }, ' INCDIR works as expected' );
352
350
}
353
351
{
@@ -356,7 +354,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
356
354
fresh_perl_like(
357
355
' @INC = ("a",bless({},"CB"),"e");'
358
356
.' eval "require Frobnitz" or print $@' ,
359
- qr !\(\@ INC contains : a CB=HASH\( 0x[A-Fa-f0-9]+\) e\) ! ,
357
+ qr !\(\@ INC[ \w ]+ : a CB=HASH\( 0x[A-Fa-f0-9]+\) e\) ! ,
360
358
{ }, ' Objects with no INC or INCDIR method are stringified' );
361
359
}
362
360
{
@@ -366,7 +364,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
366
364
' {package CB; use overload qw("")=>sub { "blorg"};} '
367
365
.' @INC = ("a",bless({},"CB"),"e");'
368
366
.' eval "require Frobnitz" or print $@' ,
369
- qr !\(\@ INC contains : a blorg e\) ! ,
367
+ qr !\(\@ INC[ \w ]+ : a blorg e\) ! ,
370
368
{ }, ' Objects with overload and no INC or INCDIR method are stringified' );
371
369
}
372
370
{
@@ -375,7 +373,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
375
373
fresh_perl_like(
376
374
' @INC = ("a",bless(sub { warn "blessed sub called" },"CB"),"e");'
377
375
.' eval "require Frobnitz" or print $@' ,
378
- qr ! blessed sub called.*\(\@ INC contains : a CB=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
376
+ qr ! blessed sub called.*\(\@ INC[ \w ]+ : a CB=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
379
377
{ }, ' Blessed subs with no hook methods are executed' );
380
378
}
381
379
{
@@ -412,7 +410,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
412
410
' sub CB::INCDIR { "i" } sub CB2::INCDIR { }'
413
411
.' @INC = ("a",bless(sub{"b"},"CB"),bless(sub{"c"},"CB2"),"e");'
414
412
.' eval "require Frobnitz" or print $@' ,
415
- qr !\(\@ INC contains : a CB=CODE\( 0x[a-fA-F0-9]+\) i CB2=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
413
+ qr !\(\@ INC[ \w ]+ : a CB=CODE\( 0x[a-fA-F0-9]+\) i CB2=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
416
414
{ }, ' Blessed subs with INCDIR methods call INCDIR' );
417
415
}
418
416
{
@@ -422,6 +420,6 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
422
420
' sub CB::INCDIR { return @{$_[2]} }'
423
421
.' @INC = ("a",[bless([],"CB"),"b"],"c");'
424
422
.' eval "require Frobnitz" or print $@' ,
425
- qr !\(\@ INC contains : a ARRAY\( 0x[a-fA-F0-9]+\) CB=ARRAY\( 0x[a-fA-F0-9]+\) b c\) ! s ,
423
+ qr !\(\@ INC[ \w ]+ : a ARRAY\( 0x[a-fA-F0-9]+\) CB=ARRAY\( 0x[a-fA-F0-9]+\) b c\) ! s ,
426
424
{ }, ' INCDIR ref returns are stringified' );
427
425
}
0 commit comments