lib/ExtUtils/PATCHING Suggestions for patching MakeMaker
lib/ExtUtils/README MakeMaker README
lib/ExtUtils/t/00compile.t See if MakeMaker modules compile
-lib/ExtUtils/t/00setup_dummy.t Setup MakeMaker test module
lib/ExtUtils/t/backwards.t Check MakeMaker's backwards compatibility
lib/ExtUtils/t/basic.t See if MakeMaker can build a module
lib/ExtUtils/t/bytes.t Test ExtUtils::MakeMaker::bytes
lib/ExtUtils/TODO Things TODO in MakeMaker
lib/ExtUtils/t/oneliner.t See if MM can generate perl one-liners
lib/ExtUtils/t/Packlist.t See if Packlist works
+lib/ExtUtils/t/parse_version.t See if parse_version works
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_print.t See if PREREQ_PRINT works
lib/ExtUtils/t/vmsish.t Test ExtUtils::MakeMaker::vmsish
lib/ExtUtils/t/writemakefile_args.t See if WriteMakefile works
lib/ExtUtils/typemap Extension interface types
-lib/ExtUtils/t/zz_cleanup_dummy.t Cleanup MakeMaker test module
lib/ExtUtils/xsubpp External subroutine preprocessor
lib/fastcwd.pl a faster but more dangerous getcwd
lib/Fatal.pm Make errors in functions/builtins fatal
t/lib/h2ph.pht Generated output from h2ph.h by h2ph, for comparison
t/lib/locale/latin1 Part of locale.t in Latin 1
t/lib/locale/utf8 Part of locale.t in UTF8
+t/lib/MakeMaker/Test/Setup/BFD.pm MakeMaker test utilities
+t/lib/MakeMaker/Test/Setup/Problem.pm MakeMaker test utilities
t/lib/MakeMaker/Test/Setup/Recurs.pm MakeMaker test utilities
t/lib/MakeMaker/Test/Utils.pm MakeMaker test utilities
t/lib/Math/BigFloat/Subclass.pm Empty subclass of BigFloat for test
+6.19 Mon Nov 3 22:53:56 PST 2003
+ - Removed 00setup_dummy.t and zz_cleanup_dummy.t. Tests now setup and
+ teardown the dummy modules as needed.
+ - Little test glitch on systems without $Config{usevendorprefix} set
+ - INSTALL(SITE|VENDOR)MAN*DIR now fall back to $(INSTALLMAN*DIR)
+ instead of copying its value. This lets "perl Makefile.PL
+ INSTALLMAN1DIR=/some/man/man1" work like expected.
+
+6.18 Mon Nov 3 20:09:51 PST 2003
+ - parse_version() was blowing over $_ (Ilya Zakharevich)
+ - 5.6.2 has the same Cygwin shared lib name fix as 5.7.0. (Gerrit Haase)
+ * When $Config{install(site|vendor)man*dir} aren't set it will now
+ fall back to $Config{installman*dir}. Similar for
+ $Config{install(site|vendor)bin}. This preserves behavior for older
+ Perls.
+ * Eliminated the dependency on perl.h for pure-perl builds.
+ * Eliminated .exists files. Added blibdirs target using MKPATH instead.
+ - Removed now unused dir_target() method.
+ - Added a little documentation to instmodsh.
+ * Made sure PREFIX always has something in it. Module authors like to use
+ it when extending MakeMaker. Currently using one of
+ PERL/SITE/VENDORPREFIX based on the value of INSTALLDIRS.
+ * Added SIGN to generate module signatures with cpansign (Autrijus Tang)
+ - Slight tweaks to MAKEFILE_OLD and MAKE_APERL_FILE restoring a mistake
+ made around 6.06 to fix static builds on OS/2
+ - Added ExtUtils::Command::dos2unix()
+ * manicopy() would make the copied files read-only if 'cp' was used.
+ * Fixed prereq check for modules which are also keywords like if.pm and
+ open.pm (Autrijus Tang)
+ - Made ExtUtils::Command mv and cp return whether or not they succeeded.
+ * metafile_addtomanifest now mentions what its doing.
+ * metafile will not die if it can't write to META.yml, just emit a
+ warning. This lets 'make dist' continue with a read-only META.yml
+ - Small fix to identify UWIN on NT (Randy Sims)
+ * metafile will not touch the META.yml if it does not need to be changed
+ (Thanks to Tim Bunce for this idea)
+ * Fixed 'make uninstall' which looks like its been broken since last
+ November and nobody noticed.
+ - Fixing minor bug in VMS prefixification logic when PREFIX was not set
+ by the user.
+ - Fixing potential bug in prefixification for relative directories
+ * Documented UNINST=1
+
6.17 Sun Sep 14 20:52:45 PDT 2003
- Fixing LD so it can be set properly on Win32. (Orton Yves)
* Fixing the init_PERL() "tack $Config{exe_ext} onto $^X" logic so
use File::Basename;
use File::Path qw(rmtree);
require Exporter;
-use vars qw(@ISA @EXPORT $VERSION);
-@ISA = qw(Exporter);
-@EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f);
-$VERSION = '1.05';
+use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
+@ISA = qw(Exporter);
+@EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f chmod
+ dos2unix);
+$VERSION = '1.06';
my $Is_VMS = $^O eq 'VMS';
perl -MExtUtils::Command -e mkpath directories...
perl -MExtUtils::Command -e eqtime source destination
perl -MExtUtils::Command -e test_f file
- perl -MExtUtils::Command=chmod -e chmod mode files...
+ perl -MExtUtils::Command -e chmod mode files...
+ ...
=head1 DESCRIPTION
=item mv source... destination
-Moves source to destination.
-Multiple sources are allowed if destination is an existing directory.
+Moves source to destination. Multiple sources are allowed if
+destination is an existing directory.
+
+Returns true if all moves succeeded, false otherwise.
=cut
sub mv {
- my $dst = pop(@ARGV);
expand_wildcards();
- croak("Too many arguments") if (@ARGV > 1 && ! -d $dst);
- foreach my $src (@ARGV) {
- move($src,$dst);
+ my @src = @ARGV;
+ my $dst = pop @src;
+
+ croak("Too many arguments") if (@src > 1 && ! -d $dst);
+
+ my $nok = 0;
+ foreach my $src (@src) {
+ $nok ||= !move($src,$dst);
}
+ return !$nok;
}
=item cp source... destination
-Copies source to destination.
-Multiple sources are allowed if destination is an existing directory.
+Copies source to destination. Multiple sources are allowed if
+destination is an existing directory.
+
+Returns true if all copies succeeded, false otherwise.
=cut
sub cp {
- my $dst = pop(@ARGV);
expand_wildcards();
- croak("Too many arguments") if (@ARGV > 1 && ! -d $dst);
- foreach my $src (@ARGV) {
- copy($src,$dst);
+ my @src = @ARGV;
+ my $dst = pop @src;
+
+ croak("Too many arguments") if (@src > 1 && ! -d $dst);
+
+ my $nok = 0;
+ foreach my $src (@src) {
+ $nok ||= !copy($src,$dst);
}
+ return $nok;
}
=item chmod mode files...
=cut
sub chmod {
+ local @ARGV = @ARGV;
my $mode = shift(@ARGV);
expand_wildcards();
chmod(oct $mode,@ARGV) || die "Cannot chmod ".join(' ',$mode,@ARGV).":$!";
sub test_f
{
- exit !-f shift(@ARGV);
+ exit !-f $ARGV[0];
}
+=item dos2unix
+
+Converts DOS and OS/2 linefeeds to Unix style recursively.
-1;
-__END__
+=cut
+
+sub dos2unix {
+ require File::Find;
+ File::Find::find(sub {
+ return if -d $_;
+ return unless -w _;
+ return if -B _;
+
+ local @ARGV = $_;
+ local $^I = '';
+ local $\;
+
+ while (<>) {
+ s/\015\012/\012/g;
+ print;
+ }
+
+ }, @ARGV);
+}
=back
=head1 AUTHOR
-Nick Ing-Simmons <F<nick@ni-s.u-net.com>>.
+Nick Ing-Simmons C<ni-s@cpan.org>
+
+Currently maintained by Michael G Schwern C<schwern@pobox.com>.
=cut
=cut
sub uninstall {
- my($packlist) = shift;
+ my($packlist) = shift @ARGV;
require ExtUtils::Install;
Original author lost in the mists of time. Probably the same as Makemaker.
-Currently maintained by Michael G Schwern <F<schwern@pobox.com>>
+Currently maintained by Michael G Schwern C<schwern@pobox.com>
-Send patches and ideas to <F<makemaker@perl.org>>.
+Send patches and ideas to C<makemaker@perl.org>.
Send bug reports via http://rt.cpan.org/. Please send your
generated Makefile along with your report.
-For more up-to-date information, see http://www.makemaker.org.
+For more up-to-date information, see L<http://www.makemaker.org>.
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
-See F<http://www.perl.com/perl/misc/Artistic.html>
+See L<http://www.perl.com/perl/misc/Artistic.html>
=cut
merge_bleadperl$
^blib/
^pm_to_blib
+^blibdirs
.DS_Store
\#
^bleadperl\.patch$
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: ExtUtils-MakeMaker
-version: 6.17
+version: 6.19
version_from: lib/ExtUtils/MakeMaker.pm
installdirs: perl
requires:
Pod::Man: 0
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+generated_by: ExtUtils::MakeMaker version 6.19
if( $^O eq 'MSWin32' ) {
Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
}
-$Is{UWIN} = 1 if $^O eq 'uwin';
+$Is{UWIN} = 1 if $^O =~ /^uwin(-nt)?$/;
$Is{Cygwin} = 1 if $^O eq 'cygwin';
$Is{NW5} = 1 if $Config{osname} eq 'NetWare'; # intentional
$Is{BeOS} = 1 if $^O =~ /beos/i; # XXX should this be that loose?
use strict;
use vars qw($VERSION @ISA);
-$VERSION = 0.07;
+$VERSION = 0.08;
@ISA = qw(File::Spec);
use Config;
return (grep { $flavors{$_} } @_) ? 1 : 0;
}
+=item blibdirs_target (o)
+
+ my $make_frag = $mm->blibdirs_target;
+
+Creates the blibdirs target which creates all the directories we use in
+blib/.
+
+=cut
+
+sub blibdirs_target {
+ my $self = shift;
+
+ my @dirs = map { uc "\$(INST_$_)" } qw(libdir
+ autodir archautodir
+ bin script
+ man1dir man3dir
+ );
+ my @mkpath = $self->split_command('$(NOECHO) $(MKPATH)', @dirs);
+ my @chmod = $self->split_command('$(NOECHO) $(CHMOD) 755', @dirs);
+
+ my $make = "\nblibdirs : \n";
+ $make .= join "", map { "\t$_\n" } @mkpath, @chmod;
+ $make .= "\t\$(NOECHO) \$(TOUCH) blibdirs\n\n";
+
+ return $make;
+}
+
+
=back
=head2 File::Spec wrappers
}
chop $arg_str;
- push @cmds, $self->escape_newlines("$cmd\n$arg_str");
+ push @cmds, $self->escape_newlines("$cmd \n$arg_str");
} while @args;
return @cmds;
my $ver = $self->{PREREQ_PM}{$mod};
$prereq_pm .= sprintf " %-30s %s\n", "$mod:", $ver;
}
-
+
my $meta = <<YAML;
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
YAML
- my @write_meta = $self->echo($meta, 'META.yml');
- return sprintf <<'MAKE_FRAG', join "\n\t", @write_meta;
+ my @write_meta = $self->echo($meta, 'META_new.yml');
+ my $move = $self->oneliner(<<'CODE', ['-MExtUtils::Command', '-MFile::Compare']);
+compare(@ARGV) != 0 ? (mv or warn "Cannot move @ARGV: $!\n") : unlink(shift);
+CODE
+
+ return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta), $move;
metafile :
+ $(NOECHO) $(ECHO) Generating META.yml
%s
+ -$(NOECHO) %s META_new.yml META.yml
MAKE_FRAG
}
my $self = shift;
return <<'MAKE_FRAG' if !$self->{SIGN};
-signature:
+signature :
$(NOECHO) $(NOOP)
MAKE_FRAG
return <<'MAKE_FRAG';
-signature:
+signature : signature_addtomanifest
cpansign -s
MAKE_FRAG
return sprintf <<'MAKE_FRAG', $add_meta;
metafile_addtomanifest:
+ $(NOECHO) $(ECHO) Adding META.yml to MANIFEST
$(NOECHO) %s
MAKE_FRAG
my $self = shift;
return <<'MAKE_FRAG' if !$self->{SIGN};
-signature_addtomanifest:
+signature_addtomanifest :
$(NOECHO) $(NOOP)
MAKE_FRAG
CODE
return sprintf <<'MAKE_FRAG', $add_sign;
-signature_addtomanifest:
+signature_addtomanifest :
+ $(NOECHO) $(ECHO) Adding SIGNATURE to MANIFEST
$(NOECHO) %s
MAKE_FRAG
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = 1.06;
+$VERSION = 1.07;
=head1 NAME
if ($Config{useshrplib} eq 'true') {
my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}";
- if( $] >= 5.007 ) {
+ if( $] >= 5.006002 ) {
$libperl =~ s/a$/dll.a/;
}
$self->{PERL_ARCHIVE} = $libperl;
use File::Basename;
use vars qw(@ISA $VERSION);
-$VERSION = '2.06';
+$VERSION = '2.07';
require ExtUtils::MM_Win32;
@ISA = qw(ExtUtils::MM_Win32);
return '' unless $self->has_link_code;
my $m = <<'END';
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs
$(RM_RF) $@
END
$m .= <<'END' if $self->{PERL_SRC};
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs
-
-
+
+
END
- $m .= $self->dir_target('$(INST_ARCHAUTODIR)');
return $m;
}
$(CHMOD) 755 $@
MAKE_FRAG
- $m .= $self->dir_target('$(INST_ARCHAUTODIR)');
-
return $m;
}
use Exporter ();
use Carp;
use Config qw(%Config);
-use File::Basename qw(basename dirname fileparse);
+use File::Basename qw(basename dirname);
use DirHandle;
use vars qw($VERSION @ISA
use ExtUtils::MakeMaker qw($Verbose neatvalue);
-$VERSION = '1.42';
+$VERSION = '1.44';
require ExtUtils::MM_Any;
@ISA = qw(ExtUtils::MM_Any);
push(@otherfiles, qw[./blib $(MAKE_APERL_FILE)
$(INST_ARCHAUTODIR)/extralibs.all
$(INST_ARCHAUTODIR)/extralibs.ld
- perlmain.c tmon.out mon.out so_locations pm_to_blib
+ perlmain.c tmon.out mon.out so_locations
+ blibdirs pm_to_blib
*$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
$(BOOTSTRAP) $(BASEEXT).bso
$(BASEEXT).def lib$(BASEEXT).def
join "", @m;
}
-=item dir_target (o)
-
-Takes an array of directories that need to exist and returns a
-Makefile entry for a .exists file in these directories. Returns
-nothing, if the entry has already been processed. We're helpless
-though, if the same directory comes as $(FOO) _and_ as "bar". Both of
-them get an entry, that's why we use "::".
-
-=cut
-
-sub dir_target {
-# --- Make-Directories section (internal method) ---
-# dir_target(@array) returns a Makefile entry for the file .exists in each
-# named directory. Returns nothing, if the entry has already been processed.
-# We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
-# Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
-# prerequisite, because there has to be one, something that doesn't change
-# too often :)
-
- my($self,@dirs) = @_;
- my(@m,$dir,$targdir);
- foreach $dir (@dirs) {
- my($src) = $self->catfile($self->{PERL_INC},'perl.h');
- my($targ) = $self->catfile($dir,'.exists');
- # catfile may have adapted syntax of $dir to target OS, so...
- if ($Is_VMS) { # Just remove file name; dirspec is often in macro
- ($targdir = $targ) =~ s:/?\.exists\z::;
- }
- else { # while elsewhere we expect to see the dir separator in $targ
- $targdir = dirname($targ);
- }
- next if $self->{DIR_TARGET}{$self}{$targdir}++;
- push @m, qq{
-$targ :: $src
- \$(NOECHO) \$(MKPATH) $targdir
- \$(NOECHO) \$(EQUALIZE_TIMESTAMP) $src $targ
-};
- push(@m, qq{
- -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $targdir
-}) unless $Is_VMS;
- }
- join "", @m;
-}
-
=item init_DEST
$mm->init_DEST
my($self) = shift;
return <<'MAKE_FRAG';
-distdir : metafile metafile_addtomanifest signature signature_addtomanifest
+distdir : metafile metafile_addtomanifest signature
$(RM_RF) $(DISTVNAME)
$(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
# As Mkbootstrap might not write a file (if none is required)
# we use touch to prevent make continually trying to remake it.
# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP): $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(BOOTSTRAP): $(FIRST_MAKEFILE) $(BOOTDEP) blibdirs
$(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
$(NOECHO) $(PERLRUN) \
"-MExtUtils::Mkbootstrap" \
$(NOECHO) $(TOUCH) $(BOOTSTRAP)
$(CHMOD) $(PERM_RW) $@
-$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_BOOT): $(BOOTSTRAP) blibdirs
$(NOECHO) $(RM_RF) $(INST_BOOT)
-$(CP) $(BOOTSTRAP) $(INST_BOOT)
$(CHMOD) $(PERM_RW) $@
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
INST_DYNAMIC_FIX = '.$ld_fix.'
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
');
if ($armaybe ne ':'){
$ldfrom = 'tmp$(LIB_EXT)';
my $libs = '$(LDLOADLIBS)';
- if ($Is_NetBSD) {
+ if ($Is_NetBSD && $Config{'useshrplib'}) {
# Use nothing on static perl platforms, and to the flags needed
# to link against the shared libperl library on shared perl
# platforms. We peek at lddlflags to see if we need -Wl,-R
# or -R to add paths to the run-time library search path.
- if ($Config{'useshrplib'}) {
- if ($Config{'lddlflags'} =~ /-Wl,-R/) {
- $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl';
- } elsif ($Config{'lddlflags'} =~ /-R/) {
- $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl';
- }
- }
+ if ($Config{'lddlflags'} =~ /-Wl,-R/) {
+ $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl';
+ } elsif ($Config{'lddlflags'} =~ /-R/) {
+ $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl';
+ }
}
push(@m,
$(CHMOD) $(PERM_RWX) $@
';
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('',@m);
}
EOP
}
}
- }
-
- unless(-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")))
- {
- die qq{
-Error: Unable to locate installed Perl libraries or Perl source code.
-
-It is recommended that you install perl in a standard location before
-building extensions. Some precompiled versions of perl do not contain
-these header files, so you cannot build extensions. In such a case,
-please build and install your perl from a fresh perl distribution. It
-usually solves this kind of problem.
-
-\(You get this message, because MakeMaker could not find "$perl_h"\)
-};
- }
-# print STDOUT "Using header files found in $self->{PERL_INC}\n"
-# if $Verbose && $self->needs_linking();
-
+ }
}
# We get SITELIBEXP and SITEARCHEXP directly via
$self->{NOOP} ||= '$(SHELL) -c true';
$self->{NOECHO} = '@' unless defined $self->{NOECHO};
- $self->{MAKEFILE} ||= 'Makefile';
- $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE};
- $self->{MAKEFILE_OLD} ||= '$(FIRST_MAKEFILE).old';
- $self->{MAKE_APERL_FILE} ||= '$(FIRST_MAKEFILE).aperl';
+ $self->{FIRST_MAKEFILE} ||= 'Makefile';
+ $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
+ $self->{MAKEFILE_OLD} ||= $self->{MAKEFILE}.'.old';
+ $self->{MAKE_APERL_FILE} ||= $self->{MAKEFILE}.'.aperl';
$self->{SHELL} ||= $Config{sh} || '/bin/sh';
$self->init_lib2arch;
- # Initialize installvendorman*dir if necessary
+ # There are often no Config.pm defaults for these new man variables so
+ # we fall back to the old behavior which is to use installman*dir
+ foreach my $num (1, 3) {
+ my $k = 'installsiteman'.$num.'dir';
+
+ $self->{uc $k} ||= uc "\$(installman${num}dir)"
+ unless $Config{$k};
+ }
+
foreach my $num (1, 3) {
my $k = 'installvendorman'.$num.'dir';
- unless ($Config{$k}) {
- $Config_Override{$k} = $Config{usevendorprefix} ?
- $self->catdir($Config{vendorprefixexp}, 'man', "man$num") :
- '';
+ unless( $Config{$k} ) {
+ $self->{uc $k} ||= $Config{usevendorprefix}
+ ? uc "\$(installman${num}dir)"
+ : '';
}
}
+ $self->{INSTALLSITEBIN} ||= '$(INSTALLBIN)'
+ unless $Config{installsitebin};
+
+ unless( $Config{installvendorbin} ) {
+ $self->{INSTALLVENDORBIN} ||= $Config{usevendorprefix}
+ ? $Config{installbin}
+ : '';
+ }
+
+
my $iprefix = $Config{installprefixexp} || $Config{installprefix} ||
$Config{prefixexp} || $Config{prefix} || '';
my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : '';
# 5.005_03 doesn't have a siteprefix.
$sprefix = $iprefix unless $sprefix;
- # There are often no Config.pm defaults for these, but we can make
- # it up.
- unless( $Config{installsiteman1dir} ) {
- $Config_Override{installsiteman1dir} =
- $self->catdir($sprefix, 'man', 'man1');
- }
-
- unless( $Config{installsiteman3dir} ) {
- $Config_Override{installsiteman3dir} =
- $self->catdir($sprefix, 'man', 'man3');
- }
-
- unless( $Config{installsitebin} ) {
- $Config_Override{installsitebin} =
- $self->catdir($sprefix, 'bin');
- }
$self->{PREFIX} ||= '';
$self->{PERLPREFIX} ||= $iprefix;
$self->{SITEPREFIX} ||= $sprefix;
$self->{VENDORPREFIX} ||= $vprefix;
+
+ # Lots of MM extension authors like to use $(PREFIX) so we
+ # put something sensible in there no matter what.
+ $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)';
}
my $arch = $Config{archname};
return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
return "" unless @{$self->{EXE_FILES}};
my(@m, $from, $to, %fromto, @to);
- push @m, $self->dir_target(qw[$(INST_SCRIPT)]);
for $from (@{$self->{EXE_FILES}}) {
my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
local($_) = $path; # for backwards compatibility
last unless defined $from;
my $todir = dirname($to);
push @m, "
-$to: $from \$(FIRST_MAKEFILE) " . $self->catdir($todir,'.exists') . "
+$to: $from \$(FIRST_MAKEFILE) blibdirs
\$(NOECHO) \$(RM_F) $to
\$(CP) $from $to
\$(FIXIN) $to
";
push @m, "
-\$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)\$(DIRFILESEP).exists ".join(" \\\n\t", @$extra).'
+\$(INST_ARCHAUTODIR)/extralibs.all: blibdirs ".join(" \\\n\t", @$extra).'
$(NOECHO) $(RM_F) $@
$(NOECHO) $(TOUCH) $@
';
my $result;
local *FH;
local $/ = "\n";
+ local $_;
open(FH,$parsefile) or die "Could not open '$parsefile': $!";
my $inpod = 0;
while (<FH>) {
print STDERR " prefixify $var => $path\n" if $Verbose >= 2;
print STDERR " from $sprefix to $rprefix\n" if $Verbose >= 2;
- if( $path !~ s{^\Q$sprefix\E\b}{$rprefix}s && $self->{ARGS}{PREFIX} ) {
+ if( $self->{ARGS}{PREFIX} && $self->file_name_is_absolute($path) &&
+ $path !~ s{^\Q$sprefix\E\b}{$rprefix}s )
+ {
print STDERR " cannot prefix, using default.\n" if $Verbose >= 2;
print STDERR " no default!\n" if !$default && $Verbose >= 2;
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs
$(RM_RF) $@
END
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
MAKE_FRAG
- push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)');
join('', @m);
}
my(@m);
push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'};
-
+
push @m, '
pure_all :: config pm_to_blib subdirs linkext
$(NOECHO) $(NOOP)
subdirs :: $(MYEXTLIB)
$(NOECHO) $(NOOP)
-config :: $(FIRST_MAKEFILE) $(INST_LIBDIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-config :: $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-config :: $(INST_AUTODIR)$(DIRFILESEP).exists
+config :: $(FIRST_MAKEFILE) blibdirs
$(NOECHO) $(NOOP)
';
- push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
-
- if (%{$self->{MAN1PODS}}) {
- push @m, q[
-config :: $(INST_MAN1DIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
- }
- if (%{$self->{MAN3PODS}}) {
- push @m, q[
-config :: $(INST_MAN3DIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
- }
+ push @m, $self->blibdirs_target;
push @m, '
$(O_FILES): $(H_FILES)
use File::Basename;
use vars qw($Revision @ISA $VERSION);
-($VERSION) = '5.70';
-($Revision) = q$Revision: 1.110 $ =~ /Revision:\s+(\S+)/;
+($VERSION) = '5.71';
+($Revision) = q$Revision: 1.113 $ =~ /Revision:\s+(\S+)/;
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
";
push @m, '
-$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt blibdirs $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
$(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
If F$TrnLNm("',$shr,'").eqs."" Then Define/NoLog/User ',"$shr Sys\$Share:$shr.$Config{'dlext'}",'
Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,$(PERL_INC)perlshr_attr.opt/Option
';
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('',@m);
}
# As MakeMaker mkbootstrap might not write a file (if none is required)
# we use touch to prevent make continually trying to remake it.
# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP) : $(FIRST_MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(BOOTSTRAP) : $(FIRST_MAKEFILE) '."$self->{BOOTDEP}".' blibdirs
$(NOECHO) $(ECHO) "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
$(NOECHO) $(PERLRUN) -
-e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
$(NOECHO) $(TOUCH) $(MMS$TARGET)
-$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_BOOT) : $(BOOTSTRAP) blibdirs
$(NOECHO) $(RM_RF) $(INST_BOOT)
- $(CP) $(BOOTSTRAP) $(INST_BOOT)
';
my(@m,$lib);
push @m,'
# Rely on suffix rule for update action
-$(OBJECT) : $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(OBJECT) : blibdirs
$(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
';
foreach $lib (split ' ', $self->{EXTRALIBS}) {
push(@m,"\t",'$(NOECHO) $(PERL) -e "print qq{',$lib,'\n}" >>$(INST_ARCHAUTODIR)extralibs.ld',"\n");
}
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('',@m);
}
}
$todir = $self->fixpath($todir,1);
push @m, "
-$to : $from \$(FIRST_MAKEFILE) ${todir}\$(DIRFILESEP).exists
+$to : $from \$(FIRST_MAKEFILE) blibdirs
\$(CP) $from $to
-", $self->dir_target($todir);
+";
}
join "", @m;
}
}
}
push(@otherfiles, qw[ blib $(MAKE_APERL_FILE)
- perlmain.c pm_to_blib pm_to_blib.ts ]);
+ perlmain.c blibdirs pm_to_blib pm_to_blib.ts ]);
push(@otherfiles, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
push(@otherfiles, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.ld'));
# Occasionally files are repeated several times from different sources
{ my(%of) = map { ($_ => 1) } @otherfiles; @otherfiles = keys %of; }
-
+
my $line = '';
foreach my $file (@otherfiles) {
$file = $self->fixpath($file);
print STDERR " no Config found for $var.\n" if $Verbose >= 2;
$path = $self->_prefixify_default($rprefix, $default);
}
+ elsif( !$self->{ARGS}{PREFIX} || !$self->file_name_is_absolute($path) ) {
+ # do nothing if there's no prefix or if its relative
+ }
elsif( $sprefix eq $rprefix ) {
print STDERR " no new prefix.\n" if $Verbose >= 2;
}
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = '1.09';
+$VERSION = '1.10';
$ENV{EMXSHELL} = 'sh'; # to run `commands`
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs
$(RM_RF) $@
END
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs
MAKE_FRAG
- push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)');
join('', @m);
}
OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
');
if ($GCC) {
push(@m,
$(CHMOD) $(PERM_RWX) $@
';
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('',@m);
}
require ExtUtils::MM_Win32;
@ISA = qw(ExtUtils::MM_Win32);
-use Config;
+use Config;\r
my $DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
my $NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
sub xs_o {
my($self) = shift;
return '' unless $self->needs_linking();
- # Having to choose between .xs -> .c -> .o and .xs -> .o confuses dmake.
- return '' if $DMAKE;
'
.xs$(OBJ_EXT):
$(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
=head1 AUTHOR
-Code originally inside MM_Win32. Original author unknown.
+Code originally inside MM_Win32. Original author unknown.
-Currently maintained by Michael G Schwern <schwern@pobox.com>.
+Currently maintained by Michael G Schwern C<schwern@pobox.com>.
-Send patches and ideas to <F<makemaker@perl.org>>.
+Send patches and ideas to C<makemaker@perl.org>.
See http://www.makemaker.org.
BEGIN {require 5.005_03;}
-$VERSION = '6.17';
-($Revision) = q$Revision: 1.133 $ =~ /Revision:\s+(\S+)/;
+$VERSION = '6.19';
+($Revision) = q$Revision: 1.141 $ =~ /Revision:\s+(\S+)/;
require Exporter;
use Config;
foreach my $dir (@{$self->{DIR}}){
my($abs) = $self->catdir($pwd,$dir);
- $self->eval_in_x($abs);
+ eval { $self->eval_in_x($abs); };
+ last if $@;
}
chdir $pwd;
+ die $@ if $@;
}
sub eval_in_x {
@Overridable = @MM_Sections;
push @Overridable, qw[
- dir_target libscan makeaperl needs_linking perm_rw perm_rwx
+ blibdirs_target libscan makeaperl needs_linking perm_rw perm_rwx
subdir_x test_via_harness test_via_script init_PERL
];
foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) {
# 5.8.0 has a bug with require Foo::Bar alone in an eval, so an
# extra statement is a workaround.
- eval "require $prereq; 0";
+ my $file = "$prereq.pm";
+ $file =~ s{::}{/}g;
+ eval { require $file };
my $pr_version = $prereq->VERSION || 0;
perl -le 'print join $/, @INC'
+Sometimes older versions of the module you're installing live in other
+directories in @INC. Because Perl loads the first version of a module it
+finds, not the newest, you might accidentally get one of these older
+versions even after installing a brand new version. To delete I<all other
+versions of the module you're installing> (not simply older ones) set the
+C<UNINST> variable.
+
+ make install UNINST=1
+
=head2 PREFIX and LIB attribute
$VERSION = '1.00';
*VERSION = \'1.01';
- $VERSION = sprintf "%d.%03d", q$Revision: 1.133 $ =~ /(\d+)/g;
+ $VERSION = sprintf "%d.%03d", q$Revision: 1.141 $ =~ /(\d+)/g;
$FOO::VERSION = '1.10';
*FOO::VERSION = \'1.11';
our $VERSION = 1.2.3; # new for perl5.6.0
If you still need a different solution, try to develop another
subroutine that fits your needs and submit the diffs to
-F<makemaker@perl.org>
+C<makemaker@perl.org>
For a complete description of all MakeMaker methods see
L<ExtUtils::MM_Unix>.
=head1 AUTHORS
-Andy Dougherty <F<doughera@lafayette.edu>>, Andreas KE<ouml>nig
-<F<andreas.koenig@mind.de>>, Tim Bunce <F<timb@cpan.org>>. VMS
-support by Charles Bailey <F<bailey@newman.upenn.edu>>. OS/2 support
-by Ilya Zakharevich <F<ilya@math.ohio-state.edu>>.
+Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig
+C<andreas.koenig@mind.de>, Tim Bunce C<timb@cpan.org>. VMS
+support by Charles Bailey C<bailey@newman.upenn.edu>. OS/2 support
+by Ilya Zakharevich C<ilya@math.ohio-state.edu>.
-Currently maintained by Michael G Schwern <F<schwern@pobox.com>>
+Currently maintained by Michael G Schwern C<schwern@pobox.com>
-Send patches and ideas to <F<makemaker@perl.org>>.
+Send patches and ideas to C<makemaker@perl.org>.
Send bug reports via http://rt.cpan.org/. Please send your
generated Makefile along with your report.
-For more up-to-date information, see http://www.makemaker.org.
+For more up-to-date information, see L<http://www.makemaker.org>.
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
-See F<http://www.perl.com/perl/misc/Artistic.html>
+See L<http://www.perl.com/perl/misc/Artistic.html>
=cut
=head1 NAME
-ExtUtils::MakeMaker::bytes - Version agnostic bytes.pm
+ExtUtils::MakeMaker::bytes - Version-agnostic bytes.pm
=head1 SYNOPSIS
=head1 NAME
-ExtUtils::MakeMaker::vmsish - Platform agnostic vmsish.pm
+ExtUtils::MakeMaker::vmsish - Platform-agnostic vmsish.pm
=head1 SYNOPSIS
$Is_MacOS $Is_VMS
$Debug $Verbose $Quiet $MANIFEST $DEFAULT_MSKIP);
-$VERSION = 1.42;
+$VERSION = 1.43;
@ISA=('Exporter');
@EXPORT_OK = qw(mkmanifest
manicheck filecheck fullcheck skipcheck
=item manicopy
- manicopy($src, $dest_dir);
- manicopy($src, $dest_dir, $how);
+ manicopy(\%src, $dest_dir);
+ manicopy(\%src, $dest_dir, $how);
-copies the files that are the keys in the HASH I<%$src> to the
-$dest_dir. The HASH reference $read is typically returned by the
-maniread() function. This function is useful for producing a directory
-tree identical to the intended distribution tree. The third parameter
-$how can be used to specify a different methods of "copying". Valid
+Copies the files that are the keys in %src to the $dest_dir. %src is
+typically returned by the maniread() function.
+
+ manicopy( maniread(), $dest_dir );
+
+This function is useful for producing a directory tree identical to the
+intended distribution tree.
+
+$how can be used to specify a different methods of "copying". Valid
values are C<cp>, which actually copies the files, C<ln> which creates
hard links, and C<best> which mostly links the files but copies any
-symbolic link to make a tree without any symbolic link. Best is the
+symbolic link to make a tree without any symbolic link. C<cp> is the
default.
=cut
sub cp {
my ($srcFile, $dstFile) = @_;
- my ($perm,$access,$mod) = (stat $srcFile)[2,8,9];
+ my ($access,$mod) = (stat $srcFile)[8,9];
+
copy($srcFile,$dstFile);
utime $access, $mod + ($Is_VMS ? 1 : 0), $dstFile;
- # chmod a+rX-w,go-w
- chmod( 0444 | ( $perm & 0111 ? 0111 : 0 ), $dstFile )
- unless ($^O eq 'MacOS');
+ _manicopy_chmod($dstFile);
}
+
sub ln {
my ($srcFile, $dstFile) = @_;
return &cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95());
link($srcFile, $dstFile);
- # chmod a+r,go-w+X (except "X" only applies to u=x)
- local($_) = $dstFile;
- my $mode= 0444 | (stat)[2] & 0700;
- if (! chmod( $mode | ( $mode & 0100 ? 0111 : 0 ), $_ )) {
+ unless( _manicopy_chmod($dstFile) ) {
unlink $dstFile;
return;
}
1;
}
-unless (defined $Config{d_link}) {
- # Really cool fix from Ilya :)
- local $SIG{__WARN__} = sub {
- warn @_ unless $_[0] =~ /^Subroutine .* redefined/;
- };
- *ln = \&cp;
-}
-
-
+# 1) Strip off all group and world permissions.
+# 2) Let everyone read it.
+# 3) If the owner can execute it, everyone can.
+sub _manicopy_chmod {
+ my($file) = shift;
+ my $perm = 0444 | (stat $file)[2] & 0700;
+ chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $file );
+}
sub best {
my ($srcFile, $dstFile) = @_;
- if (-l $srcFile) {
+ if (!$Config{d_link} or -l $srcFile) {
cp($srcFile, $dstFile);
} else {
ln($srcFile, $dstFile) or cp($srcFile, $dstFile);
my($file) = @_;
return $file unless $Is_MacOS;
-
+
$file =~ s|^\./||;
if ($file =~ m|/|) {
$file =~ s|/+|:|g;
$file = ":$file";
}
-
+
$file;
}
sub _maccat {
my($f1, $f2) = @_;
-
+
return "$f1/$f2" unless $Is_MacOS;
-
+
$f1 .= ":$f2";
$f1 =~ s/([^:]:):/$1/g;
return $f1;
=head1 AUTHOR
-Andreas Koenig <F<andreas.koenig@anima.de>>
+Andreas Koenig C<andreas.koenig@anima.de>
+
+Currently maintained by Michael G Schwern C<schwern@pobox.com>
=cut
Most Unixen: The make utility which comes with your operating system
should work fine. If you don't have one, GNU make is recommended,
most others (Sun, BSD, etc...) will work fine as well.
+http://www.gnu.org/software/make/make.html GNU make
Windows: nmake or dmake will work. GNU make will *not*.
-ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
-http://search.cpan.org/author/GSAR/dmake-4.1pl1-win32/
+ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe nmake
+http://search.cpan.org/author/GSAR/dmake-4.1pl1-win32/ dmake
VMS: MMS or the free MadGoat MaKe utility (MMK) will work.
-http://www.madgoat.com/mmk.html
+http://www.madgoat.com/mmk.html MMK
If all else fails there is a pure Perl version of make available on
CPAN which should work on most Unixen.
-http://search.cpan.org/author/NI-S/Make-1.00/
+http://search.cpan.org/author/NI-S/Make-1.00/ pmake
PLEASE NOTE: This distribution does not include the xsubpp or typemap
Fill in the IMPORTS docs.
-Document "make install UNINST=1"
-
Remove tar -I Sun-ism from instmodsh.
Consider adding a timeout option to prompt() and env variable.
Add 'how to install additional files' to ExtUtils::MakeMaker::FAQ.
-Fix NORECUSE bug continuing to set DIR
-
Give typemap location its own macro.
Merge MM_VMS->tool_xsubpp
use vars qw($Inst @Modules);
-################################################################################
+
+=head1 NAME
+
+instmodsh - A shell to examine installed modules
+
+=head1 SYNOPSIS
+
+ instmodsh
+
+=head1 DESCRIPTION
+
+A little interface to ExtUtils::Installed to examine installed modules,
+validate your packlists and even create a tarball from an installed module.
+
+=cut
+
sub do_module($)
{
}
BEGIN {
- use Test::More tests => 26;
+ use Test::More tests => 34;
use File::Spec;
}
@ARGV = ( $Testfile );
ok( test_f(), 'now creating that file' );
+ is_deeply( \@ARGV, [$Testfile], 'test_f preserves @ARGV' );
@ARGV = ( $Testfile );
ok( -e $ARGV[0], 'created!' );
# change a file to read-write
@ARGV = ( '0600', $Testfile );
+ my @orig_argv = @ARGV;
ExtUtils::Command::chmod();
+ is_deeply( \@ARGV, \@orig_argv, 'chmod preserves @ARGV' );
is( ((stat($Testfile))[2] & 07777) & 0700,
($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' );
# copy a file to a nested subdirectory
unshift @ARGV, $Testfile;
+ @orig_argv = @ARGV;
cp();
+ is_deeply( \@ARGV, \@orig_argv, 'cp preserves @ARGV' );
ok( -e File::Spec->join( 'ecmddir', 'temp2', $Testfile ), 'copied okay' );
# move a file to a subdirectory
@ARGV = ( $Testfile, 'ecmddir' );
- mv();
+ @orig_argv = @ARGV;
+ ok( mv() );
+ is_deeply( \@ARGV, \@orig_argv, 'mv preserves @ARGV' );
ok( ! -e $Testfile, 'moved file away' );
ok( -e File::Spec->join( 'ecmddir', $Testfile ), 'file in new location' );
ok( ! -e $dir, "removed $dir successfully" );
}
+{
+ mkdir 'd2utest';
+ open(FILE, '>d2utest/foo');
+ print FILE "stuff\015\012and thing\015\012";
+ close FILE;
+
+ open(FILE, '>d2utest/bar');
+ binmode(FILE);
+ my $bin = "\c@\c@\c@\c@\c@\c@\cA\c@\c@\c@\015\012".
+ "\@\c@\cA\c@\c@\c@8__LIN\015\012";
+ print FILE $bin;
+ close FILE;
+
+ local @ARGV = 'd2utest';
+ ExtUtils::Command::dos2unix();
+
+ open(FILE, 'd2utest/foo');
+ is( join('', <FILE>), "stuff\012and thing\012", 'dos2unix' );
+ close FILE;
+
+ open(FILE, 'd2utest/bar');
+ binmode(FILE);
+ ok( -B 'd2utest/bar' );
+ is( join('', <FILE>), $bin, 'dos2unix preserves binaries');
+ close FILE;
+}
+
END {
1 while unlink $Testfile, 'newfile';
File::Path::rmtree( 'ecmddir' );
+ File::Path::rmtree( 'd2utest' );
}
}
use strict;
-use Test::More tests => 23;
+use Test::More tests => 26;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
use File::Spec;
use TieOut;
my $Curdir = File::Spec->curdir;
my $Updir = File::Spec->updir;
+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: $!");
}
use strict;
-use Test::More tests => 36;
+use Test::More tests => 52;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
use File::Spec;
use TieOut;
my $Curdir = File::Spec->curdir;
my $Updir = File::Spec->updir;
+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: $!");
Writing\ $Makefile\ for\ Big::Dummy\n
}x );
+is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' );
+
isa_ok( $mm, 'ExtUtils::MakeMaker' );
is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
);
while( my($type, $vars) = each %Install_Vars) {
-
- SKIP: foreach my $var (@$vars) {
+ SKIP: {
skip "VMS must expand macros in INSTALL* vars", scalar @$vars
- if $Is_VMS;
-
- my $prefix = '$('.$type.'PREFIX)';
-
- # support for man page skipping
- $prefix = 'none' if $type eq 'PERL' &&
- $var =~ /man/ &&
- !$Config{"install$var"};
- like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, "$prefix + $var" );
+ if $Is_VMS;
+ skip '$Config{usevendorprefix} not set', scalar @$vars
+ if $type eq 'VENDOR' and !$Config{usevendorprefix};
+
+ foreach my $var (@$vars) {
+ my $installvar = "install$var";
+ my $prefix = '$('.$type.'PREFIX)';
+
+ SKIP: {
+ skip uc($installvar).' set to another INSTALL variable', 1
+ if $mm->{uc $installvar} =~ /^\$\(INSTALL.*\)$/;
+
+ # support for man page skipping
+ $prefix = 'none' if $type eq 'PERL' &&
+ $var =~ /man/ &&
+ !$Config{$installvar};
+ like( $mm->{uc $installvar}, qr/^\Q$prefix\E/,
+ "$prefix + $var" );
+ }
+ }
}
}
%ExtUtils::MM_Unix::Config = %Config;
*ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
- $ExtUtils::MM_Unix::Config{installman1dir} = '';
- $ExtUtils::MM_Unix::Config{installman3dir} = '';
+ _set_config(installman1dir => '');
+ _set_config(installman3dir => '');
my $wibble = File::Spec->catdir(qw(wibble and such));
my $stdout = tie *STDOUT, 'TieOut' or die;
%ExtUtils::MM_Unix::Config = %Config;
*ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
- $ExtUtils::MM_Unix::Config{installvendorman1dir} =
- File::Spec->catdir('foo','bar');
- $ExtUtils::MM_Unix::Config{installvendorman3dir} = '';
- $ExtUtils::MM_Unix::Config{usevendorprefix} = 1;
- $ExtUtils::MM_Unix::Config{vendorprefixexp} = 'something';
+ _set_config(installvendorman1dir => File::Spec->catdir('foo','bar') );
+ _set_config(installvendorman3dir => '' );
+ _set_config(usevendorprefix => 1 );
+ _set_config(vendorprefixexp => 'something' );
my $stdout = tie *STDOUT, 'TieOut' or die;
my $mm = WriteMakefile(
isnt( $mm->{INSTALLVENDORMAN3DIR}, '',
'installvendorman3dir (not in %Config) set' );
}
+
+# Check that when installsiteman*dir isn't set in Config it falls back
+# to installman*dir
+{
+ undef *ExtUtils::MM_Unix::Config;
+ undef *ExtUtils::MM_Unix::Config_Override;
+ %ExtUtils::MM_Unix::Config = %Config;
+ *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
+
+ _set_config(installman1dir => File::Spec->catdir('foo', 'bar') );
+ _set_config(installman3dir => File::Spec->catdir('foo', 'baz') );
+ _set_config(installsiteman1dir => '' );
+ _set_config(installsiteman3dir => '' );
+ _set_config(installvendorman1dir => '' );
+ _set_config(installvendorman3dir => '' );
+ _set_config(usevendorprefix => 'define' );
+ _set_config(vendorprefixexp => 'something' );
+
+ my $wibble = File::Spec->catdir(qw(wibble and such));
+ my $stdout = tie *STDOUT, 'TieOut' or die;
+ my $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PERL_CORE => $ENV{PERL_CORE},
+ );
+
+ is( $mm->{INSTALLMAN1DIR}, File::Spec->catdir('foo', 'bar') );
+ is( $mm->{INSTALLMAN3DIR}, File::Spec->catdir('foo', 'baz') );
+ is( $mm->{INSTALLSITEMAN1DIR}, '$(INSTALLMAN1DIR)' );
+ is( $mm->{INSTALLSITEMAN3DIR}, '$(INSTALLMAN3DIR)' );
+ is( $mm->{INSTALLVENDORMAN1DIR}, '$(INSTALLMAN1DIR)' );
+ is( $mm->{INSTALLVENDORMAN3DIR}, '$(INSTALLMAN3DIR)' );
+}
+
+
+# Check that when usevendoprefix and installvendorman*dir aren't set in
+# Config it leaves them unset.
+{
+ undef *ExtUtils::MM_Unix::Config;
+ undef *ExtUtils::MM_Unix::Config_Override;
+ %ExtUtils::MM_Unix::Config = %Config;
+ *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
+
+ _set_config(installman1dir => File::Spec->catdir('foo', 'bar') );
+ _set_config(installman3dir => File::Spec->catdir('foo', 'baz') );
+ _set_config(installsiteman1dir => '' );
+ _set_config(installsiteman3dir => '' );
+ _set_config(installvendorman1dir => '' );
+ _set_config(installvendorman3dir => '' );
+ _set_config(usevendorprefix => '' );
+ _set_config(vendorprefixexp => '' );
+
+ my $wibble = File::Spec->catdir(qw(wibble and such));
+ my $stdout = tie *STDOUT, 'TieOut' or die;
+ my $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PERL_CORE => $ENV{PERL_CORE},
+ );
+
+ is( $mm->{INSTALLMAN1DIR}, File::Spec->catdir('foo', 'bar') );
+ is( $mm->{INSTALLMAN3DIR}, File::Spec->catdir('foo', 'baz') );
+ is( $mm->{INSTALLSITEMAN1DIR}, '$(INSTALLMAN1DIR)' );
+ is( $mm->{INSTALLSITEMAN3DIR}, '$(INSTALLMAN3DIR)' );
+ is( $mm->{INSTALLVENDORMAN1DIR}, '' );
+ is( $mm->{INSTALLVENDORMAN3DIR}, '' );
+}
+
+
+sub _set_config {
+ my($k,$v) = @_;
+ (my $k_no_install = $k) =~ s/^install//i;
+ $ExtUtils::MM_Unix::Config{$k} = $v;
+
+ # Because VMS's config has traditionally been underpopulated, it will
+ # fall back to the install-less versions in desperation.
+ $ExtUtils::MM_Unix::Config{$k_no_install} = $v if $Is_VMS;
+ return;
+}
use File::Path;
use File::Spec;
-use Test::More tests => 29;
+use Test::More tests => 32;
+
+use MakeMaker::Test::Setup::BFD;
BEGIN { use_ok('ExtUtils::Install') }
}
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
chdir 'Big-Dummy';
my $stdout = tie *STDOUT, 'TieOut';
# init_linker
{
my $libperl = $Config{libperl} || 'libperl.a';
- $libperl =~ s/\.a/.dll.a/ if $] >= 5.007;
+ $libperl =~ s/\.a/.dll.a/ if $] >= 5.006002;
$libperl = "\$(PERL_INC)/$libperl";
my $export = '';
plan skip_all => 'Non-Unix platform';
}
else {
- plan tests => 115;
+ plan tests => 110;
}
}
BEGIN { use_ok( 'ExtUtils::MM_Unix' ); }
-use vars qw($VERSION);
-$VERSION = '0.02';
use strict;
use File::Spec;
const_loadlibs
constants
depend
- dir_target
dist
dist_basics
dist_ci
###############################################################################
# maybe_command
-is ($t->maybe_command('blargel'),undef,"'blargel' isn't a command");
+open(FILE, ">command"); print FILE "foo"; close FILE;
+ok (!$t->maybe_command('command') ,"non executable file isn't a command");
+chmod 0755, "command";
+ok ($t->maybe_command('command'), "executable file is a command");
+unlink "command";
###############################################################################
# nicetext (dummy method)
is ($t->nicetext('LOTR'),'LOTR','nicetext');
-###############################################################################
-# parse_version
-
-my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t'
- : 'MM_Unix.t';
-
-is( $t->parse_version($self_name), '0.02', 'parse_version on ourself');
-
-my %versions = (
- '$VERSION = 0.0' => 0.0,
- '$VERSION = -1.0' => -1.0,
- '$VERSION = undef' => 'undef',
- '$wibble = 1.0' => 'undef',
- );
-
-while( my($code, $expect) = each %versions ) {
- open(FILE, ">VERSION.tmp") || die $!;
- print FILE "$code\n";
- close FILE;
-
- is( $t->parse_version('VERSION.tmp'), $expect, $code );
-
- unlink "VERSION.tmp";
-}
-
###############################################################################
# perl_script (on unix any ordinary, readable file)
+my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t'
+ : 'MM_Unix.t';
is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()');
###############################################################################
{
my $my_perl = $1 if $^X =~ /(.*)/; # are we in -T or -t?
my( $perl, $path ) = fileparse( $my_perl );
- like( $MM->find_perl( $], [ $perl ], [ $path ], 0 ),
+ like( $MM->find_perl( $], [ $perl ], [ $path ], 0 ), \r
qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' );
}
use strict;
-# these files help the test run
-use Test::More tests => 41;
+use Test::More tests => 49;
use Cwd;
-# these files are needed for the module itself
use File::Spec;
use File::Path;
+use File::Find;
+
+my $Is_VMS = $^O eq 'VMS';
# We're going to be chdir'ing and modules are sometimes loaded on the
# fly in this test, so we need an absolute @INC.
}
sub read_manifest {
- open( M, 'MANIFEST' ) or return;
- chomp( my @files = <M> );
+ open( M, 'MANIFEST' ) or return;
+ chomp( my @files = <M> );
close M;
- return @files;
+ return @files;
}
sub catch_warning {
- my $warn;
- local $SIG{__WARN__} = sub { $warn .= $_[0] };
- return join('', $_[0]->() ), $warn;
+ my $warn;
+ local $SIG{__WARN__} = sub { $warn .= $_[0] };
+ return join('', $_[0]->() ), $warn;
}
sub remove_dir {
- ok( rmdir( $_ ), "remove $_ directory" ) for @_;
+ ok( rmdir( $_ ), "remove $_ directory" ) for @_;
}
# use module, import functions
'both files found' );
is( $_, 'foo', q{maniread() doesn't clobber $_} );
+ok( mkdir( 'copy', 0777 ), 'made copy directory' );
+
+# Check that manicopy copies files.
+manicopy( $files, 'copy', 'cp' );
+my @copies = ();
+find( sub { push @copies, $_ if -f }, 'copy' );
+@copies = map { s/\.$//; $_ } @copies if $Is_VMS; # VMS likes to put dots on
+ # the end of files.
+# Have to compare insensitively for non-case preserving VMS
+is_deeply( [sort map { lc } @copies], [sort map { lc } keys %$files] );
+
+# cp would leave files readonly, so check permissions.
+foreach my $orig (@copies) {
+ my $copy = "copy/$orig";
+ ok( -r $copy, "$copy: must be readable" );
+ is( -w $copy, -w $orig, " writable if original was" );
+ is( -x $copy, -x $orig, " executable if original was" );
+}
+rmtree('copy');
+
+
# poison the manifest, and add a comment that should be reported
add_file( 'MANIFEST', 'none #none' );
is( ExtUtils::Manifest::maniread()->{none}, '#none',
'maniread found comment' );
ok( mkdir( 'copy', 0777 ), 'made copy directory' );
-
$files = maniread();
eval { (undef, $warn) = catch_warning( sub {
manicopy( $files, 'copy', 'cp' ) })
chmod( 0600, 'MANIFEST' );
}
-
+
END {
is( unlink( keys %Files ), keys %Files, 'remove all added files' );
use strict;
use Config;
-use Test::More tests => 73;
+use Test::More tests => 79;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use File::Find;
use File::Spec;
use File::Path;
$| = 1;
+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: $!");
# look like. :(
_normalize($manifest);
is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' );
+my $meta_mtime = (stat('META.yml'))[9];
+
+sleep 1;
+my $metafile_out = run("$make metafile");
+is( $?, 0, 'metafile' ) || diag($metafile_out);
+is( (stat('META.yml'))[9], $meta_mtime, 'META.yml untouched if not changed' );
+ok( !-e 'META_new.yml', 'temp META.yml file not left around' );
# Test NO_META META.yml suppression
unlink 'META.yml';
ok( !-f 'META.yml', 'META.yml deleted' );
@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"});
cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
-my $metafile_out = run("$make metafile");
+$metafile_out = run("$make metafile");
is( $?, 0, 'metafile' ) || diag($metafile_out);
ok( !-f 'META.yml', 'META.yml generation suppressed by NO_META' );
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use Test::More 'no_plan';
+use ExtUtils::MakeMaker;
+
+my %versions = ('$VERSION = 0.02' => 0.02,
+ '$VERSION = 0.0' => 0.0,
+ '$VERSION = -1.0' => -1.0,
+ '$VERSION = undef' => 'undef',
+ '$wibble = 1.0' => 'undef',
+ );
+
+while( my($code, $expect) = each %versions ) {
+ open(FILE, ">VERSION.tmp") || die $!;
+ print FILE "$code\n";
+ close FILE;
+
+ $_ = 'foo';
+ is( MM->parse_version('VERSION.tmp'), $expect, $code );
+ is( $_, 'foo', '$_ not leaked by parse_version' );
+
+ unlink "VERSION.tmp";
+}
}
use strict;
-use Test::More tests => 5;
+use Test::More tests => 8;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
use TieOut;
my $Makefile = makefile_name;
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
ok( chdir 'Big-Dummy', q{chdir'd to Big-Dummy} ) ||
diag("chdir failed: $!");
use File::Spec;
use ExtUtils::MM;
+my $Is_Dosish = $^O =~ /^(dos|MSWin32)$/;
+
my $mm = bless {}, 'MM';
my $default = File::Spec->catdir(qw(this that));
is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default),
'prefixify w/defaults and PREFIX');
-{
+SKIP: {
+ skip "Test for DOSish prefixification", 1 unless $Is_Dosish;
+
undef *ExtUtils::MM_Unix::Config;
$ExtUtils::MM_Unix::Config{wibble} = 'C:\opt\perl\wibble';
$mm->prefixify('wibble', 'C:\opt\perl', 'C:\yarrow');
is( $mm->{WIBBLE}, 'C:\yarrow\wibble', 'prefixify Win32 paths' );
- { package ExtUtils::MM_Unix; Config->import }
}
use strict;
use Config;
-use Test::More tests => 8;
+use Test::More tests => 11;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
# 'make disttest' sets a bunch of environment variables which interfere
# with our testing.
$| = 1;
+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: $!");
chdir 't';
use strict;
-use Test::More tests => 3;
+use Test::More tests => 6;
use ExtUtils::MM;
+use MakeMaker::Test::Setup::Problem;
use TieOut;
my $MM = bless { DIR => ['subdir'] }, 'MM';
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
ok( chdir 'Problem-Module', "chdir'd to Problem-Module" ) ||
diag("chdir failed: $!");
}
use strict;
-use Test::More tests => 13;
+use Test::More tests => 16;
use TieOut;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
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: $!");
+++ /dev/null
-#!/usr/bin/perl -w
-
-BEGIN {
- if( $ENV{PERL_CORE} ) {
- @INC = ('../lib', 'lib');
- }
- else {
- unshift @INC, 't/lib';
- }
-}
-chdir($^O eq 'VMS' ? 'BFD_TEST_ROOT:[t]' : 't');
-
-
-use strict;
-use Test::More tests => 3;
-use File::Path;
-
-rmtree('Big-Dummy');
-ok(!-d 'Big-Dummy', 'Big-Dummy cleaned up');
-rmtree('Problem-Module');
-ok(!-d 'Problem-Module', 'Problem-Module cleaned up');
-rmtree('dummy-install');
-ok(!-d 'dummy-install', 'dummy-install cleaned up');
-#!/usr/bin/perl -w
+package MakeMaker::Test::Setup::BFD;
-BEGIN {
- if( $ENV{PERL_CORE} ) {
- @INC = ('../lib', 'lib');
- }
- else {
- unshift @INC, 't/lib';
- }
-}
-chdir 't';
+@ISA = qw(Exporter);
+require Exporter;
+@EXPORT = qw(setup_recurs teardown_recurs);
use strict;
-use Test::More tests => 9;
-use File::Basename;
use File::Path;
-use File::Spec;
-
-if( $^O eq 'VMS' ) {
- # On older systems we might exceed the 8-level directory depth limit
- # imposed by RMS. We get around this with a rooted logical, but we
- # can't create logical names with attributes in Perl, so we do it
- # in a DCL subprocess and put it in the job table so the parent sees it.
- open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!";
- print BFDTMP <<'COMMAND';
-$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
-$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT'
-COMMAND
- close BFDTMP;
-
- system '@bfdtesttmp.com';
- 1 while unlink 'bfdtesttmp.com';
-}
+use File::Basename;
my %Files = (
}
END
- 'Problem-Module/Makefile.PL' => <<'END',
-use ExtUtils::MakeMaker;
+ );
-WriteMakefile(
- NAME => 'Problem::Module',
-);
-END
- 'Problem-Module/subdir/Makefile.PL' => <<'END',
-printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
+sub _setup_bfd_test_root {
+ if( $^O eq 'VMS' ) {
+ # On older systems we might exceed the 8-level directory depth limit
+ # imposed by RMS. We get around this with a rooted logical, but we
+ # can't create logical names with attributes in Perl, so we do it
+ # in a DCL subprocess and put it in the job table so the parent sees it.
+ open( BFDTMP, '>bfdtesttmp.com' ) ||
+ die "Error creating command file; $!";
+ print BFDTMP <<'COMMAND';
+$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
+$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT'
+COMMAND
+ close BFDTMP;
-warn "I think I'm going to be sick\n";
-die "YYYAaaaakkk\n";
-END
+ system '@bfdtesttmp.com';
+ 1 while unlink 'bfdtesttmp.com';
+ }
+}
- );
+sub setup_recurs {
+ _setup_bfd_test_root();
+
+ while(my($file, $text) = each %Files) {
+ # Convert to a relative, native file path.
+ $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
-while(my($file, $text) = each %Files) {
- # Convert to a relative, native file path.
- $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
+ my $dir = dirname($file);
+ mkpath $dir;
+ open(FILE, ">$file") || die "Can't create $file: $!";
+ print FILE $text;
+ close FILE;
+ }
- my $dir = dirname($file);
- mkpath $dir;
- open(FILE, ">$file");
- print FILE $text;
- close FILE;
+ return 1;
+}
- ok( -e $file, "$file created" );
+sub teardown_recurs {
+ foreach my $file (keys %Files) {
+ my $dir = dirname($file);
+ if( -e $dir ) {
+ rmtree($dir) || return;
+ }
+ }
+ return 1;
}
-pass("Setup done");
+1;
--- /dev/null
+package MakeMaker::Test::Setup::Problem;
+
+@ISA = qw(Exporter);
+require Exporter;
+@EXPORT = qw(setup_recurs teardown_recurs);
+
+use strict;
+use File::Path;
+use File::Basename;
+
+my %Files = (
+ 'Problem-Module/Makefile.PL' => <<'END',
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Problem::Module',
+);
+END
+
+ 'Problem-Module/subdir/Makefile.PL' => <<'END',
+printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
+
+warn "I think I'm going to be sick\n";
+die "YYYAaaaakkk\n";
+END
+
+);
+
+
+sub setup_recurs {
+ while(my($file, $text) = each %Files) {
+ # Convert to a relative, native file path.
+ $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
+
+ my $dir = dirname($file);
+ mkpath $dir;
+ open(FILE, ">$file") || die "Can't create $file: $!";
+ print FILE $text;
+ close FILE;
+ }
+
+ return 1;
+}
+
+sub teardown_recurs {
+ foreach my $file (keys %Files) {
+ my $dir = dirname($file);
+ if( -e $dir ) {
+ rmtree($dir) || return;
+ }
+ }
+ return 1;
+}
+
+
+1;