Skip to content

Commit 6409190

Browse files
Leontbingos
authored andcommitted
Revert "Return hint file loading to quoted eval to make strict vars more useful"
This reverts commit 5490957.
1 parent 2ecb2d0 commit 6409190

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/ExtUtils/MakeMaker.pm

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,19 +1151,20 @@ sub check_hints {
11511151
}
11521152

11531153
sub _run_hintfile {
1154-
my ($self, $hint_file) = @_;
1154+
our $self;
1155+
local($self) = shift; # make $self available to the hint file.
1156+
my($hint_file) = shift;
11551157

11561158
local($@, $!);
11571159
print "Processing hints file $hint_file\n" if $Verbose;
11581160

1159-
if(open(my $fh, '<', $hint_file)) {
1160-
my $hints_content = do { local $/; <$fh> };
1161-
no strict;
1162-
eval $hints_content;
1163-
warn "Failed to run hint file $hint_file: $@" if $@;
1164-
}
1165-
else {
1166-
warn "Could not open $hint_file for read: $!";
1161+
# Just in case the ./ isn't on the hint file, which File::Spec can
1162+
# often strip off, we bung the curdir into @INC
1163+
local @INC = (File::Spec->curdir, @INC);
1164+
my $ret = do $hint_file;
1165+
if( !defined $ret ) {
1166+
my $error = $@ || $!;
1167+
warn $error;
11671168
}
11681169
}
11691170

t/hints.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ CLOO
6161
local $SIG{__WARN__} = sub { $stderr .= join '', @_ };
6262

6363
$mm->check_hints;
64-
my $Escaped_Hint_File = quotemeta($Hint_File);
65-
like( $stderr, qr{^Failed to run hint file $Escaped_Hint_File: Argh!\n\z}, 'hint files produce errors' );
64+
is( $stderr, <<OUT, 'hint files produce errors' );
65+
Argh!
66+
OUT
6667
}
6768

6869
END {

0 commit comments

Comments
 (0)