Skip to content
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
2 changes: 2 additions & 0 deletions docs/about/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ priorities and future plans.

- Dispatch bodyless `can` stubs through their class `AUTOLOAD` when present, preserving generated class introspection (#1959).

- Preserve MakeMaker test rules when `MY::test` calls `SUPER::test` in scalar context.

- Recognize boolean values as dual-valued in `Scalar::Util::isdual` (#1954).

- Recognize a bareword filehandle when `print`'s implicit `$_` list ends at a block close (#1948).
Expand Down
2 changes: 1 addition & 1 deletion src/main/perl/lib/ExtUtils/MakeMaker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ sub clean { '' }
sub test {
my ($self) = @_;
my $rule = $self->{_perlonjava_test_rule} || '';
return split /(?<=\n)/, $rule;
return wantarray ? split(/(?<=\n)/, $rule) : $rule;
}
sub top_targets { '' }

Expand Down
42 changes: 42 additions & 0 deletions src/test/resources/unit/makemaker_scalar_my_test_super.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use strict;
use warnings;
use Test::More;
use Config;
use Cwd qw(getcwd);
use File::Temp qw(tempdir);

my $orig_dir = getcwd();
my $tmpdir = tempdir(CLEANUP => 1);
END { chdir $orig_dir if defined $orig_dir }
chdir $tmpdir or die "chdir $tmpdir: $!";

open my $marker, '>', 'Makefile.PL' or die "create Makefile.PL: $!";
close $marker or die "close Makefile.PL: $!";
mkdir 't' or die "mkdir t: $!";

{
package MY;
sub test {
my $inherited = shift->SUPER::test(@_);
$inherited =~ s/\$\(TEST_FILES\)/-Iscalar-context \$(TEST_FILES)/;
$inherited;
}
}

use ExtUtils::MakeMaker;
WriteMakefile(NAME => 'Local::ScalarSuperProbe', VERSION => '0.001');

open my $makefile_fh, '<', 'Makefile' or die "open Makefile: $!";
my $makefile = do { local $/; <$makefile_fh> };
close $makefile_fh or die "close Makefile: $!";

like($makefile, qr/-Iscalar-context \$\(TEST_FILES\)/,
'scalar-context SUPER::test retains and allows edits to the inherited rule');
unlike($makefile, qr/^\d+\s*$/m,
'scalar-context SUPER::test does not become a bare list count');

my $make = $Config::Config{make} || 'make';
is(system($make, '-n', 'test'), 0,
'scalar-context MY::test output parses as a valid make target');

done_testing();
Loading