Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return hint file loading to quoted eval to make strict vars more useful #367

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lib/ExtUtils/MakeMaker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1155,20 +1155,19 @@ sub check_hints {
}

sub _run_hintfile {
our $self;
local($self) = shift; # make $self available to the hint file.
my($hint_file) = shift;
my ($self, $hint_file) = @_;

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

# Just in case the ./ isn't on the hint file, which File::Spec can
# often strip off, we bung the curdir into @INC
local @INC = (File::Spec->curdir, @INC);
my $ret = do $hint_file;
if( !defined $ret ) {
my $error = $@ || $!;
warn $error;
if(open(my $fh, '<', $hint_file)) {
eval join('', <$fh>);
warn "Failed to run hint file $hint_file: $@" if $@;
}
else {
warn "Could not open $hint_file for read: $!";
}
}

Expand Down
4 changes: 1 addition & 3 deletions t/hints.t
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ CLOO
local $SIG{__WARN__} = sub { $stderr .= join '', @_ };

$mm->check_hints;
is( $stderr, <<OUT, 'hint files produce errors' );
Argh!
OUT
like( $stderr, qr{^Failed to run hint file hints\S+\.pl: Argh!\n\z}, 'hint files produce errors' );
}

END {
Expand Down