Perl-Toolchain-Gang / ExtUtils-MakeMaker

Perl module to make Makefiles and build modules (what backs Makefile.PL)
https://metacpan.org/release/ExtUtils-MakeMaker
64 stars 76 forks source link

set status as unstable for TRIAL releases #456

Closed haarg closed 2 weeks ago

Leont commented 2 weeks ago

Perhaps we should add a TRIAL=1 argument for this?

bingos commented 2 weeks ago

I think $self->{DISTVNAME} needs to be checked for definedness.

diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm
index 27940912..b70775d7 100644
--- a/lib/ExtUtils/MM_Any.pm
+++ b/lib/ExtUtils/MM_Any.pm
@@ -1302,7 +1302,7 @@ sub metafile_data {
     $meta_merge ||= {};

     my $version = _normalize_version($self->{VERSION});
-    my $unstable = $version =~ /_/ || $self->{DISTVNAME} =~ /-TRIAL\d*$/;
+    my $unstable = $version =~ /_/ || ( defined $self->{DISTVNAME} and $self->{DISTVNAME} =~ /-TRIAL\d*$/ );
     my $release_status = $unstable ? 'unstable' : 'stable';
     my %meta = (
         # required

That fixes it for me.

Leont commented 2 weeks ago

That fixes it for me.

I don't think that is the right fix. DISTVNAME will only ever be undefined in that specific test because that constructs an incomplete MakeMaker object instead of using the actual constructor. A test-only issue should be fixed in the test instead.