lib/ExtUtils/t/Liblist.t See if ExtUtils::Liblist works
lib/ExtUtils/t/make.t See if make detection works
lib/ExtUtils/t/maketext_filter.t See if maketext_filter works
+lib/ExtUtils/t/metafile_data.t See if META.yml handling works
+lib/ExtUtils/t/metafile_file.t See if META.yml handling works
lib/ExtUtils/t/Manifest.t See if ExtUtils::Manifest works
lib/ExtUtils/t/Mkbootstrap.t See if ExtUtils::Mkbootstrap works
lib/ExtUtils/t/MM_Any.t See if ExtUtils::MM_Any works
+6.46 Sat Sep 27 17:34:03 EDT 2008
+ Bug Fixes
+ - Fix META_MERGE for more than one level of hashes. [rt.cpan.org 39348]
+
+
+6.45_02 Sun Sep 7 13:59:14 PDT 2008
+ Bug Fixes
+ - Updated bundled ExtUtils::Command to 1.14, ExtUtils::Install to
+ 1.50 and ExtUtils::Manifest to 1.54
+
+ Test Fixes
+ - t/writemakefile_args.t had the wrong skip amoung causing failures
+ when run without version.pm (mostly 5.6 users)
+
+
+6.45_01 Sat Sep 6 03:19:03 PDT 2008
+ New Features
+ * META_ADD and META_MERGE have been added to manipulate the META.yml.
+ Thanks to Adriano Ferreira. [rt.cpan.org 21282]
+ - META.yml now includes configure_requires ExtUtils::MakeMaker by
+ default. [rt.cpan.org 32337]
+ - META.yml now excludes t/ and inc/ from indexing by default.
+ - META.yml license is now "unknown" instead of undef if a LICENSE is not
+ given.
+ - META.yml now conforms to version 1.4 of the spec.
+
+ Bug Fixes
+ - Make @MM_Sections and @Overridable global again. It's an undocumented
+ but used way to manipulate MakeMaker behavior. [rt.cpan.org 36047]
+
+ Portability
+ * Changed the name/dmake test in MM_Win32.pm to use regexs to that
+ they are able to handle Perl on a Stick absolute paths.
+
+
+6.44 Thu Feb 28 16:06:04 PST 2008
+ Bug Fixes
+ * Updated bundled ExtUtils::Install to 1.45 which should fix some
+ Cygwin issues. [rt.cpan.org 33291]
+
+
6.43_01 Tue Jan 1 16:06:47 PST 2008
Bug Fixes
* Change the "is this really a Perl core library directory" checks to
our @EXPORT = qw(test_harness pod2man perllocal_install uninstall
warn_if_old_packlist);
-our $VERSION = '6.44';
+our $VERSION = '6.46';
my $Is_VMS = $^O eq 'VMS';
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
use File::Spec;
require ExtUtils::Liblist::Kid;
# Broken out of MakeMaker from version 4.11
use strict;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
use Config;
use Cwd 'cwd';
} elsif (-f ($fullname="$thispth/lib$thislib.$so")
&& (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){
} elsif (-f ($fullname="$thispth/lib${thislib}_s$Config_libext")
- && (! $Config{'archname'} =~ /RM\d\d\d-svr4/)
+ && ($Config{'archname'} !~ /RM\d\d\d-svr4/)
&& ($thislib .= "_s") ){ # we must explicitly use _s version
} elsif (-f ($fullname="$thispth/lib$thislib$Config_libext")){
} elsif (-f ($fullname="$thispth/$thislib$Config_libext")){
use strict;
use ExtUtils::MakeMaker::Config;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::Liblist;
require ExtUtils::MakeMaker;
package ExtUtils::MM_AIX;
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Unix;
our @ISA = qw(ExtUtils::MM_Unix);
package ExtUtils::MM_Any;
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
use Carp;
use File::Spec;
$(NOECHO) $(NOOP)
MAKE_FRAG
- my $prereq_pm = '';
- foreach my $mod ( sort { lc $a cmp lc $b } keys %{$self->{PREREQ_PM}} ) {
- my $ver = $self->{PREREQ_PM}{$mod};
- $prereq_pm .= sprintf "\n %-30s %s", "$mod:", $ver;
+ my @metadata = $self->metafile_data(
+ $self->{META_ADD} || {},
+ $self->{META_MERGE} || {},
+ );
+ my $meta = $self->metafile_file(@metadata);
+ my @write_meta = $self->echo($meta, 'META_new.yml');
+
+ return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta);
+metafile : create_distdir
+ $(NOECHO) $(ECHO) Generating META.yml
+ %s
+ -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
+MAKE_FRAG
+
+}
+
+
+=begin private
+
+=head3 _sort_pairs
+
+ my @pairs = _sort_pairs($sort_sub, \%hash);
+
+Sorts the pairs of a hash based on keys ordered according
+to C<$sort_sub>.
+
+=end private
+
+=cut
+
+sub _sort_pairs {
+ my $sort = shift;
+ my $pairs = shift;
+ return map { $_ => $pairs->{$_} }
+ sort $sort
+ keys %$pairs;
+}
+
+
+# Taken from Module::Build::Base
+sub _hash_merge {
+ my ($self, $h, $k, $v) = @_;
+ if (ref $h->{$k} eq 'ARRAY') {
+ push @{$h->{$k}}, ref $v ? @$v : $v;
+ } elsif (ref $h->{$k} eq 'HASH') {
+ $self->_hash_merge($h->{$k}, $_, $v->{$_}) foreach keys %$v;
+ } else {
+ $h->{$k} = $v;
}
+}
- my $author_value = defined $self->{AUTHOR}
- ? "\n - $self->{AUTHOR}"
- : undef;
- # Use a list to preserve order.
- my @meta_to_mm = (
+=head3 metafile_data
+
+ my @metadata_pairs = $mm->metafile_data(\%meta_add, \%meta_merge);
+
+Returns the data which MakeMaker turns into the META.yml file.
+
+Values of %meta_add will overwrite any existing metadata in those
+keys. %meta_merge will be merged with them.
+
+=cut
+
+sub metafile_data {
+ my $self = shift;
+ my($meta_add, $meta_merge) = @_;
+
+ # The order in which standard meta keys should be written.
+ my @meta_order = qw(
+ name
+ version
+ abstract
+ author
+ license
+ distribution_type
+
+ configure_requires
+ build_requires
+ requires
+
+ resources
+
+ provides
+ no_index
+
+ generated_by
+ meta-spec
+ );
+
+ my %meta = (
name => $self->{DISTNAME},
version => $self->{VERSION},
abstract => $self->{ABSTRACT},
- license => $self->{LICENSE},
- author => $author_value,
- generated_by =>
- "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ license => $self->{LICENSE} || 'unknown',
distribution_type => $self->{PM} ? 'module' : 'script',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0
+ },
+
+ no_index => {
+ directory => [qw(t inc)]
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
);
+ $meta{author} = defined $self->{AUTHOR} ? [$self->{AUTHOR}] : [];
+ $meta{requires} = $self->{PREREQ_PM} if defined $self->{PREREQ_PM};
- my $meta = "--- #YAML:1.0\n";
+ while( my($key, $val) = each %$meta_add ) {
+ $meta{$key} = $val;
+ }
- while( @meta_to_mm ) {
- my($key, $val) = splice @meta_to_mm, 0, 2;
+ while( my($key, $val) = each %$meta_merge ) {
+ $self->_hash_merge(\%meta, $key, $val);
+ }
- $val = '~' unless defined $val;
+ my @meta_pairs;
+
+ # Put the standard keys first in the proper order.
+ for my $key (@meta_order) {
+ next unless exists $meta{$key};
+
+ push @meta_pairs, $key, delete $meta{$key};
+ }
+
+ # Then tack everything else onto the end, alpha sorted.
+ for my $key (sort {lc $a cmp lc $b} keys %meta) {
+ push @meta_pairs, $key, $meta{$key};
+ }
+
+ return @meta_pairs
+}
- $meta .= sprintf "%-20s %s\n", "$key:", $val;
+=begin private
+
+=head3 _dump_hash
+
+ $yaml = _dump_hash(\%options, %hash);
+
+Implements a fake YAML dumper for a hash given
+as a list of pairs. No quoting/escaping is done. Keys
+are supposed to be strings. Values are undef, strings,
+hash refs or array refs of strings.
+
+Supported options are:
+
+ delta => STR - indentation delta
+ use_header => BOOL - whether to include a YAML header
+ indent => STR - a string of spaces
+ default: ''
+
+ max_key_length => INT - maximum key length used to align
+ keys and values of the same hash
+ default: 20
+ key_sort => CODE - a sort sub
+ It may be undef, which means no sorting by keys
+ default: sub { lc $a cmp lc $b }
+
+ customs => HASH - special options for certain keys
+ (whose values are hashes themselves)
+ may contain: max_key_length, key_sort, customs
+
+=end private
+
+=cut
+
+sub _dump_hash {
+ croak "first argument should be a hash ref" unless ref $_[0] eq 'HASH';
+ my $options = shift;
+ my %hash = @_;
+
+ # Use a list to preserve order.
+ my @pairs;
+
+ my $k_sort
+ = exists $options->{key_sort} ? $options->{key_sort}
+ : sub { lc $a cmp lc $b };
+ if ($k_sort) {
+ croak "'key_sort' should be a coderef" unless ref $k_sort eq 'CODE';
+ @pairs = _sort_pairs($k_sort, \%hash);
+ } else { # list of pairs, no sorting
+ @pairs = @_;
+ }
+
+ my $yaml = $options->{use_header} ? "--- #YAML:1.0\n" : '';
+ my $indent = $options->{indent} || '';
+ my $k_length = min(
+ ($options->{max_key_length} || 20),
+ max(map { length($_) + 1 } grep { !ref $hash{$_} } keys %hash)
+ );
+ my $customs = $options->{customs} || {};
+
+ # printf format for key
+ my $k_format = "%-${k_length}s";
+
+ while( @pairs ) {
+ my($key, $val) = splice @pairs, 0, 2;
+ $val = '~' unless defined $val;
+ if(ref $val eq 'HASH') {
+ if ( keys %$val ) {
+ my %k_options = ( # options for recursive call
+ delta => $options->{delta},
+ use_header => 0,
+ indent => $indent . $options->{delta},
+ );
+ if (exists $customs->{$key}) {
+ my %k_custom = %{$customs->{$key}};
+ foreach my $k qw(key_sort max_key_length customs) {
+ $k_options{$k} = $k_custom{$k} if exists $k_custom{$k};
+ }
+ }
+ $yaml .= $indent . "$key:\n"
+ . _dump_hash(\%k_options, %$val);
+ }
+ else {
+ $yaml .= $indent . "$key: {}\n";
+ }
+ }
+ elsif (ref $val eq 'ARRAY') {
+ if( @$val ) {
+ $yaml .= $indent . "$key:\n";
+
+ for (@$val) {
+ croak "only nested arrays of non-refs are supported" if ref $_;
+ $yaml .= $indent . $options->{delta} . "- $_\n";
+ }
+ }
+ else {
+ $yaml .= $indent . "$key: []\n";
+ }
+ }
+ elsif( ref $val and !blessed($val) ) {
+ croak "only nested hashes, arrays and objects are supported";
+ }
+ else { # if it's an object, just stringify it
+ $yaml .= $indent . sprintf "$k_format %s\n", "$key:", $val;
+ }
};
- $meta .= <<"YAML";
-requires: $prereq_pm
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
-YAML
+ return $yaml;
- $meta .= $self->{EXTRA_META} if $self->{EXTRA_META};
+}
- my @write_meta = $self->echo($meta, 'META_new.yml');
+sub blessed {
+ return eval { $_[0]->isa("UNIVERSAL"); };
+}
- return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta);
-metafile : create_distdir
- $(NOECHO) $(ECHO) Generating META.yml
- %s
- -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
-MAKE_FRAG
+sub max {
+ return (sort { $b <=> $a } @_)[0];
+}
+
+sub min {
+ return (sort { $a <=> $b } @_)[0];
+}
+
+=head3 metafile_file
+
+ my $meta_yml = $mm->metafile_file(@metadata_pairs);
+
+Turns the @metadata_pairs into YAML.
+
+This method does not implement a complete YAML dumper, being limited
+to dump a hash with values which are strings, undef's or nested hashes
+and arrays of strings. No quoting/escaping is done.
+
+=cut
+
+sub metafile_file {
+ my $self = shift;
+
+ my %dump_options = (
+ use_header => 1,
+ delta => ' ' x 4,
+ key_sort => undef,
+ );
+ return _dump_hash(\%dump_options, @_);
}
require ExtUtils::MM_Unix;
our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-our $VERSION = '6.44';
+our $VERSION = '6.46';
=item os_flavor
require ExtUtils::MM_Unix;
our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-our $VERSION = '6.44';
+our $VERSION = '6.46';
=head1 NAME
use strict;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
use strict;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
sub new {
die <<'UNSUPPORTED';
use ExtUtils::MakeMaker::Config;
use File::Basename;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Win32;
our @ISA = qw(ExtUtils::MM_Win32);
use ExtUtils::MakeMaker qw(neatvalue);
use File::Spec;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
package ExtUtils::MM_QNX;
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Unix;
our @ISA = qw(ExtUtils::MM_Unix);
package ExtUtils::MM_UWIN;
use strict;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
require ExtUtils::MM_Unix;
our @ISA = qw(ExtUtils::MM_Unix);
# If we make $VERSION an our variable parse_version() breaks
use vars qw($VERSION);
-$VERSION = '6.44_01';
+$VERSION = '6.46_01';
require ExtUtils::MM_Any;
our @ISA = qw(ExtUtils::MM_Any);
use File::Basename;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
package ExtUtils::MM_VOS;
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Unix;
our @ISA = qw(ExtUtils::MM_Unix);
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-our $VERSION = '6.44';
+our $VERSION = '6.46';
$ENV{EMXSHELL} = 'sh'; # to run `commands`
my $make = $self->make;
# The ^ makes sure its not interpreted as an escape in nmake
- $self->{DIRFILESEP} = $make eq 'nmake' ? '^\\' :
- $make eq 'dmake' ? '\\\\'
- : '\\';
+ $self->{DIRFILESEP} = $self->is_make_type('nmake') ? '^\\' :
+ $self->is_make_type('dmake') ? '\\\\'
+ : '\\';
}
=item B<init_others>
my $make_frag = $self->SUPER::special_targets;
- $make_frag .= <<'MAKE_FRAG' if $self->make eq 'dmake';
+ $make_frag .= <<'MAKE_FRAG' if $self->is_make_type('dmake');
.USESHELL :
MAKE_FRAG
} elsif ($BORLAND) {
push(@m,
q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,}
- .($self->make eq 'dmake'
+ .($self->is_make_type('dmake')
? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) }
.q{$(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,)}
: q{$(subst /,\,$(PERL_ARCHIVE)) $(subst /,\,$(LDLOADLIBS)) }
sub pasthru {
my($self) = shift;
- return "PASTHRU = " . ($self->make eq 'nmake' ? "-nologo" : "");
+ return "PASTHRU = " . ($self->is_make_type('nmake') ? "-nologo" : "");
}
# quotes; however it transforms {{ into { either inside and outside double
# quotes. It also translates }} into }. The escaping below is not
# 100% correct.
- if( $self->make eq 'dmake' ) {
+ if( $self->is_make_type('dmake') ) {
$text =~ s/{/{{/g;
$text =~ s/}}/}}}/g;
}
sub cd {
my($self, $dir, @cmds) = @_;
- return $self->SUPER::cd($dir, @cmds) unless $self->make eq 'nmake';
+ return $self->SUPER::cd($dir, @cmds) unless $self->is_make_type('nmake');
my $cmd = join "\n\t", map "$_", @cmds;
}
+sub is_make_type {
+ my($self, $type) = @_;
+ return !! ($self->make =~ /\b$type(?:\.exe)?$/);
+}
+
1;
__END__
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require ExtUtils::MM_Win32;
our @ISA = qw(ExtUtils::MM_Win32);
use strict;
require ExtUtils::MM;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
our @ISA = qw(ExtUtils::MM);
{
-# $Id: /local/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 54639 2008-02-29T00:06:55.056100Z schwern $
+# $Id: /local/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 66493 2008-09-27T21:35:25.560547Z schwern $
package ExtUtils::MakeMaker;
use strict;
our $Verbose = 0; # exported
our @Parent; # needs to be localized
our @Get_from_Config; # referenced by MM_Unix
-my @MM_Sections;
-my @Overridable;
+our @MM_Sections;
+our @Overridable;
my @Prepend_parent;
my %Recognized_Att_Keys;
-our $VERSION = '6.44';
-our ($Revision) = q$Revision: 54639 $ =~ /Revision:\s+(\S+)/;
+our $VERSION = '6.46';
+our ($Revision) = q$Revision: 66493 $ =~ /Revision:\s+(\S+)/;
our $Filename = __FILE__; # referenced outside MakeMaker
our @ISA = qw(Exporter);
require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect
# loading ExtUtils::MakeMaker will give them MY.
- # This will go when Embed is it's own CPAN module.
+ # This will go when Embed is its own CPAN module.
sub WriteMakefile {
LIBS => ['ARRAY',''],
MAN1PODS => 'HASH',
MAN3PODS => 'HASH',
+ META_ADD => 'HASH',
+ META_MERGE => 'HASH',
PL_FILES => 'HASH',
PM => 'HASH',
PMLIBDIRS => 'ARRAY',
AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION
C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS
- EXCLUDE_EXT EXE_FILES EXTRA_META FIRST_MAKEFILE
+ EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE
FULLPERL FULLPERLRUN FULLPERLRUNINST
FUNCLIST H IMPORTS
SITELIBEXP SITEARCHEXP
INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS LICENSE
- LINKTYPE MAKE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET
+ LINKTYPE MAKE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET
+ META_ADD META_MERGE
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
If it is intended, that a new perl binary be produced, this variable
may hold a name for that binary. Defaults to perl
+=item META_ADD
+
+=item META_MERGE
+
+A hashrefs of items to add to the F<META.yml>.
+
+They differ in how they behave if they have the same key as the
+default metadata. META_ADD will override the default value with it's
+own. META_MERGE will merge its value with the default.
+
+Unless you want to override the defaults, prefer META_MERGE so as to
+get the advantage of any future defaults.
+
=item MYEXTLIB
If the extension links to a library that it builds set this to the
$VERSION = '1.00';
*VERSION = \'1.01';
- ($VERSION) = q$Revision: 54639 $ =~ /(\d+)/g;
+ ($VERSION) = q$Revision: 66493 $ =~ /(\d+)/g;
$FOO::VERSION = '1.10';
*FOO::VERSION = \'1.11';
use strict;
-our $VERSION = '6.44';
+our $VERSION = '6.46';
use Config ();
use strict;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
my $Have_Bytes = eval { require bytes; 1; };
use strict;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
my $IsVMS = $^O eq 'VMS';
# There's just too much Dynaloader incest here to turn on strict vars.
use strict 'refs';
-our $VERSION = '6.44';
+our $VERSION = '6.46';
require Exporter;
our @ISA = ('Exporter');
our @ISA = qw(Exporter);
our @EXPORT = qw(&Mksymlists);
-our $VERSION = '6.44';
+our $VERSION = '6.46';
sub Mksymlists {
my(%spec) = @_;
+ ($ExtUtils::MM_Unix::Is{Win32} || 0)
+ ($ExtUtils::MM_Unix::Is{Dos} || 0)
+ ($ExtUtils::MM_Unix::Is{VMS} || 0);
-ok ( $os <= 1, 'There can be only one (or none)');
+cmp_ok ( $os, '<=', 1, 'There can be only one (or none)');
-cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606');
+is($ExtUtils::MM_Unix::VERSION, $ExtUtils::MakeMaker::VERSION, 'MM_Unix has a $VERSION');
# when the following calls like canonpath, catdir etc are replaced by
# File::Spec calls, the test's become a bit pointless
-foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) )
- {
- is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
- }
+foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) ) {
+ is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
+}
is ($class->catdir('xx','xx'), File::Spec->catdir('xx','xx'),
'catdir(xx, xx) => xx/xx');
###############################################################################
# post_constants, postamble, post_initialize
-foreach (qw/ post_constants postamble post_initialize/)
- {
+foreach (qw/ post_constants postamble post_initialize/) {
is ($t->$_(),'', "$_() is an empty string");
- }
+}
###############################################################################
# replace_manpage_separator
BEGIN {
if ($^O =~ /MSWin32/i) {
- plan tests => 41;
+ plan tests => 49;
} else {
plan skip_all => 'This is not Win32';
}
}
unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
+# is_make_type()
+{
+ # Check for literal nmake
+ SKIP: {
+ skip("Not using 'nmake'", 2) unless $Config{make} eq 'nmake';
+ ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' );
+ ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+ }
+
+ # Check for literal nmake
+ SKIP: {
+ skip("Not using /nmake/", 2) unless $Config{make} =~ /nmake/;
+ ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' );
+ ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+ }
+
+ # Check for literal dmake
+ SKIP: {
+ skip("Not using 'dmake'", 2) unless $Config{make} eq 'dmake';
+ ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' );
+ ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+ }
+
+ # Check for literal dmake
+ SKIP: {
+ skip("Not using /dmake/", 2) unless $Config{make} =~ /dmake/;
+ ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' );
+ ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+ }
+
+}
# xs_o() should look into that
# top_targets() should look into that
use Config;
use ExtUtils::MakeMaker;
-use Test::More tests => 83;
+use Test::More tests => 85;
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' );
+SKIP: {
+ # META.yml spec 1.4 was added in 0.11
+ skip "Test::YAML::Meta >= 0.11 required", 2
+ unless eval { require Test::YAML::Meta } and
+ Test::YAML::Meta->VERSION >= 0.11;
+
+ Test::YAML::Meta::meta_spec_ok($meta_yml);
+}
+
ok open META, $meta_yml or diag $!;
my $meta = join '', <META>;
ok close META;
is $meta, <<"END";
--- #YAML:1.0
-name: Big-Dummy
-version: 0.01
-abstract: Try "our" hot dog's
-license: ~
-author:
+name: Big-Dummy
+version: 0.01
+abstract: Try "our" hot dog's
+author:
- Michael G Schwern <schwern\@pobox.com>
-generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
-distribution_type: module
-requires:
- strict: 0
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ strict: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
END
my $manifest = maniread("$distdir/MANIFEST");
--- /dev/null
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 3;
+
+use Data::Dumper;
+
+require ExtUtils::MM_Any;
+
+my $new_mm = sub {
+ return bless {@_}, 'ExtUtils::MM_Any';
+};
+
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ];
+
+
+ is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc foo)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ], 'rt.cpan.org 39348';
+}
+
+
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ AUTHOR => 'Some Guy',
+ PREREQ_PM => {
+ Foo => 2.34,
+ Bar => 4.56,
+ },
+ );
+
+ is_deeply [$mm->metafile_data(
+ {
+ configure_requires => {
+ Stuff => 2.34
+ },
+ wobble => 42
+ },
+ {
+ no_index => {
+ package => "Thing"
+ },
+ wibble => 23
+ },
+ )],
+ [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => ['Some Guy'],
+ license => 'unknown',
+ distribution_type => 'script',
+
+ configure_requires => {
+ Stuff => 2.34,
+ },
+ requires => {
+ Foo => 2.34,
+ Bar => 4.56,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ package => 'Thing',
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+
+ wibble => 23,
+ wobble => 42,
+ ];
+}
--- /dev/null
+#!/usr/bin/perl -w
+
+# This is a test of the fake YAML dumper implemented by EUMM:
+# ExtUtils::MM_Any::metafile_file
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 13;
+
+require ExtUtils::MM_Any;
+
+my $mm = bless {}, 'ExtUtils::MM_Any';
+
+{
+ my @meta = ( a => 1, b => 2 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for flat hashes works ok");
+}
+
+{
+ my @meta = ( k1 => 'some key and value', k2 => undef, k3 => 1 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+k1: some key and value
+k2: ~
+k3: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dumping strings and undefs is ok");
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { hh => 1 } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ hh: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for nested hashes works ok");
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { h1 => 'x', h2 => 'z' } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ h1: x
+ h2: z
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "nested hashes sort ascii-betically");
+ # to tell the truth, they sort case-insensitively
+ # that's hard to test for Perl with unstable sort's
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { hh => { hhh => 1 } } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ hh:
+ hhh: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for hashes (with more nesting) works ok");
+}
+
+{
+ my @meta = ( a => 1, k => [ qw(w y z) ] );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+k:
+ - w
+ - y
+ - z
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "array of strings are handled ok");
+}
+
+is($mm->metafile_file( a => {}, b => [], c => undef ), <<'YAML', 'empty hashes and arrays');
+--- #YAML:1.0
+a: {}
+b: []
+c: ~
+YAML
+
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for something like META.yml works");
+}
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ recommends => {
+ 'Test::More' => 0,
+ 'Test::Pod' => 1.18,
+ 'Test::Pod::Coverage' => 1
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+recommends:
+ Test::More: 0
+ Test::Pod: 1.18
+ Test::Pod::Coverage: 1
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "META.yml with extra 'recommends' works");
+}
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ recommends => {
+ 'Test::More' => 0,
+ 'Test::Pod' => 1.18,
+ 'Test::Pod::Coverage' => 1
+ },
+ no_index => {
+ dir => [ qw(inc) ],
+ file => [ qw(TODO NOTES) ],
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+recommends:
+ Test::More: 0
+ Test::Pod: 1.18
+ Test::Pod::Coverage: 1
+no_index:
+ dir:
+ - inc
+ file:
+ - TODO
+ - NOTES
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "META.yml with extra 'no_index' works");
+}
+
+{
+ my @meta = ( k => 'a : b', 'x : y' => 1 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+k: a : b
+x : y: 1
+YAML
+ # NOTE: the output is not YAML-equivalent to the input
+
+ is($mm->metafile_file(@meta), $expected, "no quoting is done");
+}
+
+{
+ my @meta = ( k => \*STDOUT );
+ eval { $mm->metafile_file(@meta) };
+
+ like($@, qr/^only nested hashes, arrays and objects are supported/,
+ "we don't like but hash/array refs");
+}
+
+{
+ my @meta = ( k => [ [] ] );
+ eval { $mm->metafile_file(@meta) };
+
+ like($@, qr/^only nested arrays of non-refs are supported/,
+ "we also don't like but array of strings");
+}
+
+# recursive data structures: don't even think about it - endless recursion
}
use strict;
-use Test::More tests => 28;
+use Test::More tests => 30;
use TieOut;
use MakeMaker::Test::Utils;
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => [1,2,3],
+ 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,
+ NAME => 'Big::Dummy',
+ VERSION => 1.002_003,
);
};
is( $warnings, '' );
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => '1.002_003',
+ NAME => 'Big::Dummy',
+ VERSION => '1.002_003',
);
};
is( $warnings, '' );
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => bless {}, "Some::Class",
+ 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",6) unless eval { require version };
+ skip("Can't test version objects", 8) unless eval { require version };
version->import;
my $version = version->new("1.2.3");
$warnings = '';
- eval {
+ ok eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => $version,
+ NAME => 'Big::Dummy',
+ VERSION => $version,
);
- };
+ } || diag $@;
is( $warnings, '' );
isa_ok( $mm->{VERSION}, 'version' );
is( $mm->{VERSION}, $version );
$warnings = '';
$version = qv('1.2.3');
- eval {
+ ok eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => $version,
+ NAME => 'Big::Dummy',
+ VERSION => $version,
);
- };
+ } || diag $@;
is( $warnings, '' );
isa_ok( $mm->{VERSION}, 'version' );
is( $mm->{VERSION}, $version );
}
-}
\ No newline at end of file
+}
use strict;
use warnings;
-our $VERSION = 6.44;
+our $VERSION = 6.46;
use Cwd;
use File::Spec;