lib/ExtUtils/t/basic.t See if MakeMaker can build a module
lib/ExtUtils/t/build_man.t Set if MakeMaker builds manpages
lib/ExtUtils/t/bytes.t Test ExtUtils::MakeMaker::bytes
+lib/ExtUtils/t/cd.t Test to see cd works
lib/ExtUtils/t/config.t Test ExtUtils::MakeMaker::Config
lib/ExtUtils/t/Constant.t See if ExtUtils::Constant works
lib/ExtUtils/t/dir_target.t Verify if dir_target() is supported
lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension
lib/ExtUtils/t/eu_command.t See if ExtUtils::Command works
lib/ExtUtils/t/FIRST_MAKEFILE.t See if FIRST_MAKEFILE works
+lib/ExtUtils/t/fixin.t See if ExtUtils::MakeMaker works
lib/ExtUtils/t/hints.t See if hint files are honored.
lib/ExtUtils/t/INSTALL_BASE.t Test INSTALL_BASE in MakeMaker
lib/ExtUtils/t/Installed.t See if ExtUtils::Installed works
lib/ExtUtils/t/pm.t See if Makemaker can handle PM
lib/ExtUtils/t/postamble.t See if postamble works
lib/ExtUtils/t/prefixify.t See if MakeMaker can apply a PREFIX
+lib/ExtUtils/t/prereq.t See if MakeMaker works
lib/ExtUtils/t/prereq_print.t See if PREREQ_PRINT works
lib/ExtUtils/t/problems.t How MakeMaker reacts to build problems
lib/ExtUtils/t/prompt.t See if E::MM::prompt() works
lib/ExtUtils/t/testlib.t See if ExtUtils::testlib works
lib/ExtUtils/t/VERSION_FROM.t See if MakeMaker's VERSION_FROM works
lib/ExtUtils/t/vmsish.t Test ExtUtils::MakeMaker::vmsish
+lib/ExtUtils/t/WriteEmptyMakefile.t See if WriteEmptyMakefile works
lib/ExtUtils/t/writemakefile_args.t See if WriteMakefile works
lib/ExtUtils/t/xs.t Part of MakeMaker's test suite
lib/ExtUtils/typemap Extension interface types
use strict;
use vars qw($VERSION);
-$VERSION = 1.32_02;
+$VERSION = 1.33;
use Config;
use Cwd 'cwd';
$verbose ||= 0;
my(@crtls,$crtlstr);
- my($dbgqual) = $Config{'ldflags'};
- @crtls = ( ($dbgqual =~ m-/Debug-i ? $Config{'dbgprefix'} : '')
+ @crtls = ( ($Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '')
. 'PerlShr/Share' );
push(@crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'});
push(@crtls, grep { not /\(/ } split /\s+/, $Config{'libc'});
if ($self->{PERL_SRC}) {
my($lib,$locspec,$type);
foreach $lib (@crtls) {
- if (($locspec,$type) = $lib =~ m!^([\w\$-]+)(/\w+)?! and $locspec =~ /perl/i) {
+ if (($locspec,$type) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i) {
if (lc $type eq '/share') { $locspec .= $Config{'exe_ext'}; }
elsif (lc $type eq '/library') { $locspec .= $Config{'lib_ext'}; }
else { $locspec .= $Config{'obj_ext'}; }
use ExtUtils::MakeMaker qw($Verbose neatvalue);
-$VERSION = '1.52_04';
+$VERSION = '1.54';
require ExtUtils::MM_Any;
@ISA = qw(ExtUtils::MM_Any);
$(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
veryclean : realclean
- $(RM_F) *~ *.orig */*~ */*.orig
+ $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old
MAKE_FRAG
print "Executing $abs\n" if ($trace >= 2);
my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"};
+ $version_check = "$Config{run} $version_check"
+ if defined $Config{run} and length $Config{run};
- if (defined $Config{run}) {
- $version_check = "$Config{run} $version_check";
- }
# To avoid using the unportable 2>&1 to suppress STDERR,
# we close it before running the command.
# However, thanks to a thread library bug in many BSDs
open STDERR, '>&STDERR_COPY' if $stderr_duped;
}
- if ($val =~ /^VER_OK/) {
+ if ($val =~ /^VER_OK/m) {
print "Using PERL=$abs\n" if $trace;
return $abs;
} elsif ($trace >= 2) {
=cut
-sub fixin { # stolen from the pink Camel book, more or less
- my($self, @files) = @_;
+sub fixin { # stolen from the pink Camel book, more or less
+ my ( $self, @files ) = @_;
- my($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/;
+ my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/;
for my $file (@files) {
my $file_new = "$file.new";
my $file_bak = "$file.bak";
- local(*FIXIN);
- local(*FIXOUT);
- open(FIXIN, $file) or croak "Can't process '$file': $!";
- local $/ = "\n";
- chomp(my $line = <FIXIN>);
- next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file.
- # Now figure out the interpreter name.
- my($cmd,$arg) = split ' ', $line, 2;
- $cmd =~ s!^.*/!!;
-
- # Now look (in reverse) for interpreter in absolute PATH (unless perl).
+ local (*FIXIN);
+ local (*FIXOUT);
+ open( FIXIN, $file ) or croak "Can't process '$file': $!";
+ local $/ = "\n";
+ chomp( my $line = <FIXIN> );
+ next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file.
+ # Now figure out the interpreter name.
+ my ( $cmd, $arg ) = split ' ', $line, 2;
+ $cmd =~ s!^.*/!!;
+
+ # Now look (in reverse) for interpreter in absolute PATH (unless perl).
my $interpreter;
- if ($cmd eq "perl") {
- if ($Config{startperl} =~ m,^\#!.*/perl,) {
+ if ( $cmd eq "perl" ) {
+ if ( $Config{startperl} =~ m,^\#!.*/perl, ) {
$interpreter = $Config{startperl};
$interpreter =~ s,^\#!,,;
- } else {
+ }
+ else {
$interpreter = $Config{perlpath};
}
- } else {
- my(@absdirs) = reverse grep {$self->file_name_is_absolute} $self->path;
- $interpreter = '';
- my($dir);
- foreach $dir (@absdirs) {
- if ($self->maybe_command($cmd)) {
- warn "Ignoring $interpreter in $file\n" if $Verbose && $interpreter;
- $interpreter = $self->catfile($dir,$cmd);
- }
- }
- }
- # Figure out how to invoke interpreter on this machine.
-
- my($shb) = "";
- if ($interpreter) {
- print STDOUT "Changing sharpbang in $file to $interpreter" if $Verbose;
- # this is probably value-free on DOSISH platforms
- if ($does_shbang) {
- $shb .= "$Config{'sharpbang'}$interpreter";
- $shb .= ' ' . $arg if defined $arg;
- $shb .= "\n";
- }
- $shb .= qq{
+ }
+ else {
+ my (@absdirs)
+ = reverse grep { $self->file_name_is_absolute } $self->path;
+ $interpreter = '';
+ my ($dir);
+ foreach $dir (@absdirs) {
+ if ( $self->maybe_command($cmd) ) {
+ warn "Ignoring $interpreter in $file\n"
+ if $Verbose && $interpreter;
+ $interpreter = $self->catfile( $dir, $cmd );
+ }
+ }
+ }
+
+ # Figure out how to invoke interpreter on this machine.
+
+ my ($shb) = "";
+ if ($interpreter) {
+ print STDOUT "Changing sharpbang in $file to $interpreter"
+ if $Verbose;
+
+ # this is probably value-free on DOSISH platforms
+ if ($does_shbang) {
+ $shb .= "$Config{'sharpbang'}$interpreter";
+ $shb .= ' ' . $arg if defined $arg;
+ $shb .= "\n";
+ }
+ $shb .= qq{
eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
if 0; # not running under some shell
-} unless $Is_Win32; # this won't work on win32, so don't
- } else {
- warn "Can't find $cmd in PATH, $file unchanged"
- if $Verbose;
- next;
- }
+} unless $Is_Win32; # this won't work on win32, so don't
+ }
+ else {
+ warn "Can't find $cmd in PATH, $file unchanged"
+ if $Verbose;
+ next;
+ }
- unless ( open(FIXOUT,">$file_new") ) {
- warn "Can't create new $file: $!\n";
- next;
- }
-
- # Print out the new #! line (or equivalent).
- local $\;
- local $/;
- print FIXOUT $shb, <FIXIN>;
- close FIXIN;
- close FIXOUT;
+ unless ( open( FIXOUT, ">$file_new" ) ) {
+ warn "Can't create new $file: $!\n";
+ next;
+ }
+
+ # Print out the new #! line (or equivalent).
+ local $\;
+ local $/;
+ print FIXOUT $shb, <FIXIN>;
+ close FIXIN;
+ close FIXOUT;
chmod 0666, $file_bak;
unlink $file_bak;
- unless ( _rename($file, $file_bak) ) {
- warn "Can't rename $file to $file_bak: $!";
- next;
- }
- unless ( _rename($file_new, $file) ) {
- warn "Can't rename $file_new to $file: $!";
- unless ( _rename($file_bak, $file) ) {
- warn "Can't rename $file_bak back to $file either: $!";
- warn "Leaving $file renamed as $file_bak\n";
- }
- next;
- }
- unlink $file_bak;
- } continue {
- close(FIXIN) if fileno(FIXIN);
- system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';;
+ unless ( _rename( $file, $file_bak ) ) {
+ warn "Can't rename $file to $file_bak: $!";
+ next;
+ }
+ unless ( _rename( $file_new, $file ) ) {
+ warn "Can't rename $file_new to $file: $!";
+ unless ( _rename( $file_bak, $file ) ) {
+ warn "Can't rename $file_bak back to $file either: $!";
+ warn "Leaving $file renamed as $file_bak\n";
+ }
+ next;
+ }
+ unlink $file_bak;
+ }
+ continue {
+ close(FIXIN) if fileno(FIXIN);
+ system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
}
}
my $inc_carp_dir = dirname($INC{'Carp.pm'});
unless ($self->{PERL_SRC}){
- my($dir);
- foreach my $dir_count (1..8) # 8 is the VMS limit for nesting
- {
- $dir = $self->catdir(($Updir) x $dir_count);
- if (
- -f $self->catfile($dir,"config_h.SH")
- &&
- -f $self->catfile($dir,"perl.h")
- &&
- -f $self->catfile($dir,"lib","Exporter.pm")
- ) {
- $self->{PERL_SRC}=$dir ;
- last;
- }
- }
+ foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting
+ my $dir = $self->catdir(($Updir) x $dir_count);
+
+ if (-f $self->catfile($dir,"config_h.SH") &&
+ -f $self->catfile($dir,"perl.h") &&
+ -f $self->catfile($dir,"lib","Exporter.pm")
+ ) {
+ $self->{PERL_SRC}=$dir ;
+ last;
+ }
+ }
}
warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if
MAP_LIBPERL "$(MAP_LIBPERL)" \
>> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
-} if -f 'Makefile.PL';
+};
push @m, q{
inst_perl: pure_inst_perl doc_inst_perl
=item parse_version
-parse a file and return what you think is $VERSION in this file set to.
+ my $version = MM->parse_version($file);
+
+Parse a $file and return what $VERSION is set to by the first assignment.
It will return the string "undef" if it can't figure out what $VERSION
-is. $VERSION should be for all to see, so our $VERSION or plain $VERSION
-are okay, but my $VERSION is not.
+is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION
+are okay, but C<my $VERSION> is not.
+
+parse_version() will try to C<use version> before checking for C<$VERSION> so the following will work.
+
+ $VERSION = qv(1.2.3);
=cut
my $eval = qq{
package ExtUtils::MakeMaker::_version;
no strict;
+ BEGIN { eval {
+ require version;
+ "version"->import;
+ } }
local $1$2;
\$$2=undef; do {
}
# note: 'test.pl' name is also hardcoded in init_dirscan()
my(@m);
- my $subdirs_test = ($self->{DIR} && @{$self->{DIR}} ? 'subdirs-test' : '');
push(@m,"
TEST_VERBOSE=0
TEST_TYPE=test_\$(LINKTYPE)
testdb :: testdb_\$(LINKTYPE)
-test :: \$(TEST_TYPE) $subdirs_test
+test :: \$(TEST_TYPE) subdirs-test
+
+subdirs-test ::
+ \$(NOECHO) \$(NOOP)
+
");
foreach my $dir (@{ $self->{DIR} }) {
- my $test = $self->oneliner(sprintf <<'CODE', $dir);
-chdir '%s';
-system '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) test $(PASTHRU)'
- if -f '$(FIRST_MAKEFILE)';
-CODE
+ my $test = $self->cd($dir, '$(MAKE) test $(PASTHRU)');
+
+ push @m, <<END
+subdirs-test ::
+ \$(NOECHO) $test
- push(@m, "\nsubdirs-test ::\n\t\$(NOECHO) $test\n");
+END
}
push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n")
# $Revision can't be on the same line or SVN/K gets confused
use vars qw($Revision
$VERSION @ISA);
-$VERSION = '5.75';
+$VERSION = '5.76';
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
$(OBJECT) : $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)pp_proto.h
$(OBJECT) : $(PERL_INC)proto.h, $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h
$(OBJECT) : $(PERL_INC)regnodes.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
-$(OBJECT) : $(PERL_INC)thread.h
-$(OBJECT) : $(PERL_INC)util.h, $(PERL_INC)vmsish.h
+$(OBJECT) : $(PERL_INC)thread.h, $(PERL_INC)util.h, $(PERL_INC)vmsish.h
' if $self->{OBJECT};
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = '1.14_01';
+$VERSION = '1.15';
$ENV{EMXSHELL} = 'sh'; # to run `commands`
push(@m,
q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) }
.q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)});
+
# VS2005 (aka VC 8) or higher, but not for 64-bit compiler from Platform SDK
- if ($Config{ivsize} == 4 && $Config{cc} eq 'cl' and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14) {
+ if ($Config{ivsize} == 4 && $Config{cc} eq 'cl' and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14)
+ {
push(@m,
- q{
+ q{
mt -nologo -manifest $@.manifest -outputresource:$@;2 && del $@.manifest});
}
}
another_command
cd ..
-B<NOTE> This cd can only go one level down. So far this sufficient for
-what MakeMaker needs.
+NOTE: This only works with simple relative directories. Throw it an absolute dir or something with .. in it and things will go wrong.
=cut
my $cmd = join "\n\t", map "$_", @cmds;
+ my $updirs = $self->catdir(map { $self->updir } $self->splitdir($dir));
+
# No leading tab and no trailing newline makes for easier embedding.
- my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd;
+ my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd, $updirs;
cd %s
%s
- cd ..
+ cd %s
MAKE_FRAG
chomp $make_frag;
}
-
1;
__END__
package ExtUtils::MakeMaker::FAQ;
use vars qw($VERSION);
-$VERSION = '1.11_04';
+$VERSION = '1.12';
1;
__END__
have multiple modules to work with. It also ensures that the module
goes through its full installation process which may modify it.
+=item PREFIX vs INSTALL_BASE from Module::Build::Cookbook
+
+The behavior of PREFIX is complicated and depends closely on how your
+Perl is configured. The resulting installation locations will vary from
+machine to machine and even different installations of Perl on the same machine.
+Because of this, its difficult to document where prefix will place your modules.
+
+In contrast, INSTALL_BASE has predictable, easy to explain installation locations.
+Now that Module::Build and MakeMaker both have INSTALL_BASE there is little reason
+to use PREFIX other than to preserve your existing installation locations. If you
+are starting a fresh Perl installation we encourage you to use INSTALL_BASE. If
+you have an existing installation installed via PREFIX, consider moving it to an
+installation structure matching INSTALL_BASE and using that instead.
+
=back
SVN uses a simple integer for $Revision$ so you can adapt it for your
$VERSION like so:
- $VERSION = (q$Revision$) =~ /(\d+)/g;
+ ($VERSION) = q$Revision$ =~ /(\d+)/;
In CVS and RCS version 1.9 is followed by 1.10. Since CPAN compares
version numbers numerically we use a sprintf() to convert 1.9 to 1.009
--- /dev/null
+#!/usr/bin/perl -w
+
+# This is a test of WriteEmptyMakefile.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+chdir 't';
+
+use strict;
+use Test::More 'no_plan';
+
+use ExtUtils::MakeMaker qw(WriteEmptyMakefile);
+use TieOut;
+
+can_ok __PACKAGE__, 'WriteEmptyMakefile';
+
+eval { WriteEmptyMakefile("something"); };
+like $@, qr/Need an even number of args/;
+
+
+{
+ ok( my $stdout = tie *STDOUT, 'TieOut' );
+
+ ok !-e 'wibble';
+ END { 1 while unlink 'wibble' }
+
+ WriteEmptyMakefile(
+ NAME => "Foo",
+ FIRST_MAKEFILE => "wibble",
+ );
+ ok -e 'wibble';
+}
use strict;
use Config;
-use Test::More tests => 80;
+use Test::More tests => 83;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
use File::Find;
ok( -f $meta_yml, 'META.yml written to dist dir' );
ok( !-e "META_new.yml", 'temp META.yml file not left around' );
+ok open META, $meta_yml or diag $!;
+my @meta = <META>;
+like $meta[-1], '/\n$/', "META.yml ends with a newline";
+ok close META;
+
my $manifest = maniread("$distdir/MANIFEST");
# VMS is non-case preserving, so we can't know what the MANIFEST will
# look like. :(
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+my $Is_VMS = $^O eq 'VMS';
+
+use File::Spec;
+
+use Test::More tests => 4;
+
+my @cd_args = ("some/dir", "command1", "command2");
+
+{
+ package Test::MM_Win32;
+ use ExtUtils::MM_Win32;
+ @ISA = qw(ExtUtils::MM_Win32);
+
+ my $mm = bless {}, 'Test::MM_Win32';
+
+ {
+ local *make = sub { "nmake" };
+
+ my @dirs = (File::Spec->updir) x 2;
+ my $expected_updir = File::Spec->catdir(@dirs);
+
+ ::is $mm->cd(@cd_args),
+qq{cd some/dir
+ command1
+ command2
+ cd $expected_updir};
+ }
+
+ {
+ local *make = sub { "dmake" };
+
+ ::is $mm->cd(@cd_args),
+q{cd some/dir && command1
+ cd some/dir && command2};
+ }
+}
+
+{
+ is +ExtUtils::MM_Unix->cd(@cd_args),
+q{cd some/dir && command1
+ cd some/dir && command2};
+}
+
+SKIP: {
+ skip("VMS' cd requires vmspath which is only on VMS", 1) unless $Is_VMS;
+
+ use ExtUtils::MM_VMS;
+ is +ExtUtils::MM_VMS->cd(@cd_args),
+q{startdir = F$Environment("Default")
+ Set Default some/dir
+ command1
+ command2
+ Set Default 'startdir'};
+}
\ No newline at end of file
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+use File::Spec;
+
+use Test::More tests => 6;
+
+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: $!");
+
+# [rt.cpan.org 26234]
+{
+ local $/ = "foo";
+ local $\ = "bar";
+ MY->fixin("bin/program");
+ is $/, "foo", '$/ not clobbered';
+ is $\, "bar", '$\ not clobbered';
+}
+
}
chdir 't';
-use Test::More tests => 10;
+use Test::More;
use ExtUtils::MakeMaker;
-my %versions = ('$VERSION = 0.02' => 0.02,
+my %versions = (q[$VERSION = '1.00'] => '1.00',
+ q[*VERSION = \'1.01'] => '1.01',
+ q[($VERSION) = q$Revision: 32208 $ =~ /(\d+)/g;] => 32208,
+ q[$FOO::VERSION = '1.10';] => '1.10',
+ q[*FOO::VERSION = \'1.11';] => '1.11',
+ '$VERSION = 0.02' => 0.02,
'$VERSION = 0.0' => 0.0,
'$VERSION = -1.0' => -1.0,
'$VERSION = undef' => 'undef',
'$wibble = 1.0' => 'undef',
+ q[my $VERSION = '1.01'] => 'undef',
+ q[local $VERISON = '1.02'] => 'undef',
+ q[local $FOO::VERSION = '1.30'] => 'undef',
);
+if( eval 'our $foo' ) {
+ $versions{q[our $VERSION = '1.23';]} = '1.23',
+}
+
+if( eval 'require version; "version"->import' ) {
+ $versions{q[use version; $VERSION = qv(1.2.3);]} = qv(1.2.3);
+ $versions{q[$VERSION = qv(1.2.3)]} = qv(1.2.3);
+}
+
+plan tests => 2 * keys %versions;
+
while( my($code, $expect) = each %versions ) {
open(FILE, ">VERSION.tmp") || die $!;
print FILE "$code\n";
--- /dev/null
+#!/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 'no_plan';
+
+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 '', @_;
+ };
+
+ WriteMakefile(
+ NAME => 'Big::Dummy',
+ PREREQ_PM => {
+ strict => 0
+ }
+ );
+ is $warnings, '';
+
+ $warnings = '';
+ WriteMakefile(
+ NAME => 'Big::Dummy',
+ PREREQ_PM => {
+ strict => 99999
+ }
+ );
+ is $warnings,
+ "Warning: prerequisite strict 99999 not found. We have $strict::VERSION.\n";
+
+ $warnings = '';
+ WriteMakefile(
+ NAME => 'Big::Dummy',
+ PREREQ_PM => {
+ "I::Do::Not::Exist" => 0,
+ }
+ );
+ is $warnings,
+ "Warning: prerequisite I::Do::Not::Exist 0 not found.\n";
+
+ $warnings = '';
+ WriteMakefile(
+ NAME => 'Big::Dummy',
+ PREREQ_PM => {
+ "I::Do::Not::Exist" => 0,
+ "strict" => 99999,
+ }
+ );
+ is $warnings,
+ "Warning: prerequisite I::Do::Not::Exist 0 not found.\n".
+ "Warning: prerequisite strict 99999 not found. We have $strict::VERSION.\n";
+
+
+ $warnings = '';
+ eval {
+ WriteMakefile(
+ NAME => 'Big::Dummy',
+ PREREQ_PM => {
+ "I::Do::Not::Exist" => 0,
+ "Nor::Do::I" => 0,
+ "strict" => 99999,
+ },
+ PREREQ_FATAL => 1,
+ );
+ };
+
+ is $warnings, '';
+ is $@, <<'END', "PREREQ_FATAL";
+MakeMaker FATAL: prerequisites not found.
+ I::Do::Not::Exist not installed
+ Nor::Do::I not installed
+ strict 99999
+
+Please install these modules first and rerun 'perl Makefile.PL'.
+END
+
+}
use strict;
use Config;
-use Test::More tests => 25;
+use Test::More tests => 26;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::Recurs;
'prepend .. not stomping WriteMakefile args' )
}
close MAKEFILE;
+
+
+{
+ # Quiet "make test" failure noise
+ close *STDERR;
+
+ my $test_out = run("$make test");
+ isnt $?, 0, 'test failure in a subdir causes make to fail';
+}
\ No newline at end of file
}
use strict;
-use Test::More tests => 16;
+use Test::More 'no_plan';
use TieOut;
use MakeMaker::Test::Utils;
};
is( $warnings, <<VERIFY );
-WARNING: MAN3PODS takes a hash reference not a string/number.
+WARNING: MAN3PODS takes a HASH reference not a string/number.
Please inform the author.
VERIFY
};
is( $warnings, <<VERIFY );
-WARNING: AUTHOR takes a string/number not a code reference.
+WARNING: AUTHOR takes a string/number not a CODE reference.
Please inform the author.
VERIFY
};
# We'll get warnings about the bogus libs, that's ok.
- like( $warnings, qr{^WARNING: LIBS takes a array reference or string/number not a hash reference}m );
+ like( $warnings, qr{^WARNING: LIBS takes a ARRAY reference or string/number not a HASH reference}m );
$warnings = '';
is( $mm->{WIBBLE}, 'something' );
is_deeply( $mm->{wump}, { foo => 42 } );
-}
+
+
+ # Test VERSION
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => [1,2,3],
+ );
+ };
+ like( $warnings, qr{^WARNING: VERSION takes a version object or string/number} );
+
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => 1.002_003,
+ );
+ };
+ is( $warnings, '' );
+ is( $mm->{VERSION}, '1.002003' );
+
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => '1.002_003',
+ );
+ };
+ is( $warnings, '' );
+ is( $mm->{VERSION}, '1.002_003' );
+
+
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => bless {}, "Some::Class",
+ );
+ };
+ like( $warnings, '/^WARNING: VERSION takes a version object or string/number not a Some::Class object/' );
+
+
+ SKIP: {
+ skip("Can't test version objects",2) unless eval { require version };
+ version->import;
+
+ my $version = version->new("1.2.3");
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => $version,
+ );
+ };
+ is( $warnings, '' );
+ isa_ok( $mm->{VERSION}, 'version' );
+ is( $mm->{VERSION}, $version );
+
+ $warnings = '';
+ $version = qv('1.2.3');
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => $version,
+ );
+ };
+ is( $warnings, '' );
+ isa_ok( $mm->{VERSION}, 'version' );
+ is( $mm->{VERSION}, $version );
+ }
+}
\ No newline at end of file
VERSION => 1.00,
);
END
+
+ # Check if a test failure in a subdir causes make test to fail
+ 'Recurs/prj2/t/fail.t' => <<'END',
+#!/usr/bin/perl -w
+
+print "1..1\n";
+print "not ok 1\n";
+END
);
sub setup_recurs {
sub run {
my $cmd = shift;
- require ExtUtils::MM;
+ use ExtUtils::MM;
# Unix can handle 2>&1 and OS/2 from 5.005_54 up.
# This makes our failure diagnostics nicer to read.
# ExtUtils::CBuilder prints its compilation lines to the screen.
# Shut it up.
- require TieOut;
+ use TieOut;
local *STDOUT = *STDOUT;
local *STDERR = *STDERR;