Hello!

This is patch to add support for MIN_PERL_VERSION for Makefile.PL.
Used parts of David's patch. Tested with latest version of EUMM on Windows. It yet not adds info to META.yml - that would be second patch.

--
Alexandr Ciornii, http://chorny.net
#!/usr/bin/perl -w

# This is a test of the verification of the arguments to
# WriteMakefile.

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't' if -d 't';
        @INC = ('../lib', 'lib');
    }
    else {
        unshift @INC, 't/lib';
    }
}

use strict;
use Test::More tests => 8;

use TieOut;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;

use ExtUtils::MakeMaker;

chdir 't';

perl_lib();

ok( setup_recurs(), 'setup' );
END {
    ok( chdir File::Spec->updir );
    ok( teardown_recurs(), 'teardown' );
}

ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
  diag("chdir failed: $!");

{
    ok( my $stdout = tie *STDOUT, 'TieOut' );
    my $warnings = '';
    local $SIG{__WARN__} = sub {
        $warnings .= join '', @_;
    };

    eval {
      WriteMakefile(
        NAME            => 'Big::Dummy',
        MIN_PERL_VERSION       => 5,
      );
    };
    is $warnings, '';
    is $@, '','MIN_PERL_VERSION=5';

    $warnings = '';
    eval {
      WriteMakefile(
        NAME            => 'Big::Dummy',
        MIN_PERL_VERSION       => 999999,
      );
    };
    is $@, "This distribution won't work without a higher version of Perl.\n",
    'MIN_PERL_VERSION=999999';

}
--- MakeMaker.pm.dist   Fri Feb 29 02:06:55 2008
+++ MakeMaker.pm        Wed Apr 16 14:11:58 2008
@@ -236,7 +236,7 @@
     LINKTYPE MAKE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET 
     MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NORECURS NO_VC OBJECT OPTIMIZE 
     PERL_MALLOC_OK PERL PERLMAINCC PERLRUN PERLRUNINST PERL_CORE
-    PERL_SRC PERM_RW PERM_RWX
+    PERL_SRC PERM_RW PERM_RWX MIN_PERL_VERSION
     PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE PPM_INSTALL_EXEC
     PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
     SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
@@ -389,6 +389,10 @@
 
     check_hints($self);
 
+    if ($self->{MIN_PERL_VERSION} and $self->{MIN_PERL_VERSION} > $]) {
+        die "This distribution won't work without a higher version of Perl.\n";
+    }
+    
     my %configure_att;         # record &{$self->{CONFIGURE}} attributes
     my(%initial_att) = %$self; # record initial attributes
 

Reply via email to