-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[perl #128769] Improve base.pm @inc '.' handling
• Localise @inc only if necessary. • Don’t mention '.' in the @inc list in the error message, since it was not in the @inc that was searched (this is accomplished by local- ising @inc in the same scope as the error). • If a file exists that would have been loaded had '.' not been ignored, mention it and suggest ‘use lib’. • Use the same number of closing as opening parentheses in the error message.
- Loading branch information
Father Chrysostomos
committed
Jul 31, 2016
1 parent
10030f4
commit bca5527
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/perl -w | ||
|
||
use strict; | ||
|
||
use base (); | ||
|
||
use Test::More tests => 2; | ||
|
||
if ($INC[-1] ne '.') { push @INC, '.' } | ||
|
||
my $inc = quotemeta "@INC[0..$#INC-1]"; | ||
|
||
eval { 'base'->import("foo") }; | ||
like $@, qr/\@INC contains: $inc\).\)/, | ||
'Error does not list final dot in @INC (or mention use lib)'; | ||
eval { 'base'->import('t::lib::Dummy') }; | ||
like $@, qr<\@INC contains: $inc\).\n(?x: | ||
) If you mean to load t/lib/Dummy\.pm from the current >, | ||
'special cur dir message for existing files in . that are ignored'; |