lib/Module/Build/t/pod_parser.t Module::Build
lib/Module/Build/t/ppm.t Module::Build
lib/Module/Build/t/runthrough.t Module::Build
+lib/Module/Build/t/script_dist.t Module::Build
+lib/Module/Build/t/test_file_exts.t Module::Build
lib/Module/Build/t/test_types.t Module::Build
lib/Module/Build/t/test_type.t Module::Build
lib/Module/Build/t/tilde.t Module::Build
+lib/Module/Build/t/use_tap_harness.t Module::Build
lib/Module/Build/t/versions.t Module::Build
lib/Module/Build/t/xs.t Module::Build
lib/Module/Build/Version.pm Module::Build
use vars qw($VERSION @ISA);
@ISA = qw(Module::Build::Base);
-$VERSION = '0.2808_02';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
# Okay, this is the brute-force method of finding out what kind of
openbsd Unix
netbsd Unix
dec_osf Unix
+ nto Unix
svr4 Unix
svr5 Unix
sco_sv Unix
cygwin Unix
os2 Unix
interix Unix
-
+ gnu Unix
+ gnukfreebsd Unix
+
dos Windows
MSWin32 Windows
[version 0.01]
-This will use C<Test::Harness> to run any regression tests and report
-their results. Tests can be defined in the standard places: a file
-called C<test.pl> in the top-level directory, or several files ending
-with C<.t> in a C<t/> directory.
+This will use C<Test::Harness> or C<TAP::Harness> to run any regression
+tests and report their results. Tests can be defined in the standard
+places: a file called C<test.pl> in the top-level directory, or several
+files ending with C<.t> in a C<t/> directory.
If you want tests to be 'verbose', i.e. show details of test execution
rather than just summary information, pass the argument C<verbose=1>.
If you want to run tests under the perl debugger, pass the argument
C<debugger=1>.
+If you want to have Module::Build find test files with different file
+name extensions, pass the C<test_file_exts> argument with an array
+of extensions, such as C<[qw( .t .s .z )]>.
+
+If you want test to be run by C<TAP::Harness>, rather than C<Test::Harness>,
+pass the argument C<tap_harness_args> as an array reference of arguments to
+pass to the TAP::Harness constructor.
+
In addition, if a file called C<visual.pl> exists in the top-level
directory, this file will be executed as a Perl script and its output
will be shown to the user. This is a good place to put speed tests or
...
test_types => {
special => '.st',
- author => '.at',
+ author => ['.at', '.pt' ],
},
...
sync with your written documentation if you ever change your licensing
terms.
+You may also use a license type of C<unknown> if you don't wish to
+specify your terms in the metadata.
+
It is a fatal error to use a license other than the ones mentioned
above. This is not because I wish to impose licensing terms on you -
please let me know if you would like another license option to be
-added to the list. You may also use a license type of C<unknown> if
-you don't wish to specify your terms (but this is usually not a good
-idea for you to do!).
-
-I just started out with a small set of licenses to keep things simple,
-figuring I'd let people with actual working knowledge in this area
-tell me what to do. So if that's you, drop me a line.
+added to the list. I just started out with a small set of licenses to
+keep things simple, figuring I'd let people with actual working
+knowledge in this area tell me what to do. So if that's you, drop me
+a line.
=item meta_add
An optional parameter specifying a set of files that should be
installed as executable Perl scripts when the module is installed.
-May be given as an array reference of the files, or as a hash
-reference whose keys are the files (and whose values will currently be
-ignored).
+May be given as an array reference of the files, as a hash reference
+whose keys are the files (and whose values will currently be ignored),
+as a string giving the name of a directory in which to find scripts,
+or as a string giving the name of a single script file.
-The default is to install no script files - in other words, there is
-no default location where Module::Build will look for script files to
-install.
+The default is to install any scripts found in a F<bin> directory at
+the top level of the distribution.
For backward compatibility, you may use the parameter C<scripts>
instead of C<script_files>. Please consider this usage deprecated,
property is true, then the C<t/> directory will be scanned recursively
for C<*.t> files.
+=item use_tap_harness
+
+[version 0.2808_03]
+
+An optional parameter indicating whether or not to use TAP::Harness for
+testing rather than Test::Harness. Defaults to false. If set to true, you must
+therefore be sure to add TAP::Harness as a requirement for your module in
+L</build_requires>. Implicitly set to a true value if C<tap_harness_args> is
+specified.
+
+=item tap_harness_args
+
+[version 0.2808_03]
+
+An optional parameter specifying parameters to be passed to TAP::Harness when
+running tests. Must be given as a hash reference of parameters; see the
+L<TAP::Harness|TAP::Harness> documentation for details. Note that specifying
+this parameter will implicitly set C<use_tap_harness> to a true value. You
+must therefore be sure to add TAP::Harness as a requirement for your module in
+L</build_requires>.
=item xs_files
Returns a hash reference indicating the C<build_requires>
prerequisites that were passed to the C<new()> method.
+=item cbuilder()
+
+[version 0.2809]
+
+Returns the internal ExtUtils::CBuilder object that can be used for
+compiling & linking C code. If no such object is available (e.g. if
+the system has no compiler installed) an exception will be thrown.
+
+
=item check_installed_status($module, $version)
[version 0.11]
Module::Build's main support for configuration of installed modules.
See also L<Module::Build::Authoring/"SAVING CONFIGURATION INFORMATION">.
+=item fix_shebang_line(@files)
+
+[version 0.??]
+
+Modify any "shebang" line in the specified files to use the path to the
+perl executable being used for the current build. Files are modified
+in-place. The existing shebang line must have a command that contains
+"C<perl>"; arguments to the command do not count. In particular, this
+means that the use of C<#!/usr/bin/env perl> will not be changed.
+
+For an explanation of shebang lines, see
+L<http://en.wikipedia.org/wiki/Shebang_%28Unix%29>.
+
=item have_c_compiler()
[version 0.21]
=item prereq_action_types()
+=item program_name()
+
=item quiet()
=item recommends()
=item scripts()
+=item sign()
+
+=item tap_harness_args()
+
+=item test_file_exts()
+
=item use_rcfile()
+=item use_tap_harness()
+
=item verbose()
=item xs_files()
+# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
+# vim:ts=8:sw=2:et:sta:sts=2
package Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
BEGIN { require 5.00503 }
use Carp;
+use Cwd ();
use File::Copy ();
use File::Find ();
use File::Path ();
}
$self->{invoked_action} = $self->{action} ||= 'build';
+
+ $self->_set_install_paths;
return $self;
}
}
sub cwd {
- require Cwd;
return Cwd::cwd();
}
# proper quoting so that the subprocess sees this same list of args.
my ($self, @args) = @_;
- my $return_args = '';
my @quoted;
for (@args) {
- if ( /^[^\s*?!$<>;\\|'"\[\]\{\}]+$/ ) {
+ if ( /^[^\s*?!\$<>;\\|'"\[\]\{\}]+$/ ) {
# Looks pretty safe
push @quoted, $_;
} else {
# XXX this will obviously have to improve - is there already a
# core module lying around that does proper quoting?
- s/"/"'"'"/g;
- push @quoted, qq("$_");
+ s/('+)/'"$1"'/g;
+ push @quoted, qq('$_');
}
}
}
}
+# Tells us whether the construct open($fh, '-|', @command) is
+# supported. It would probably be better to dynamically sense this.
sub have_forkpipe { 1 }
# Determine whether a given binary is the same as the perl
# CBuilder is also in the core, so it should be available here
require ExtUtils::CBuilder;
- my $perl_src = ExtUtils::CBuilder->perl_src;
+ my $perl_src = Cwd::realpath( ExtUtils::CBuilder->perl_src );
if ( defined($perl_src) && length($perl_src) ) {
my $uninstperl =
File::Spec->rel2abs(File::Spec->catfile( $perl_src, $perl_basename ));
no strict 'refs';
if ( $type eq 'HASH' ) {
*{"$class\::$property"} = sub {
+ # XXX this needs 'use strict' again
my $self = shift;
my $x = $self->{properties};
return $x->{$property} unless @_;
} else {
*{"$class\::$property"} = sub {
+ # XXX this needs 'use strict' again
my $self = shift;
$self->{properties}{$property} = shift if @_;
return $self->{properties}{$property};
__PACKAGE__->add_property(create_packlist => 1);
__PACKAGE__->add_property(allow_mb_mismatch => 0);
__PACKAGE__->add_property(config => undef);
+__PACKAGE__->add_property(test_file_exts => ['.t']);
+__PACKAGE__->add_property(use_tap_harness => 0);
+__PACKAGE__->add_property(tap_harness_args => {});
{
my $Is_ActivePerl = eval {require ActivePerl::DocTools};
pod_files
pollute
prefix
+ program_name
quiet
recursive_test_files
script_files
scripts
+ sign
test_files
verbose
xs_files
$self->log_info("Checking features:\n");
- my $max_name_len;
+ my $max_name_len = 0;
$max_name_len = ( length($_) > $max_name_len ) ?
length($_) : $max_name_len
for keys %$features;
my $status = $self->check_installed_status($modname, $spec);
if ($status->{ok}) {
- return $status->{have} if $status->{have} and $status->{have} ne '<none>';
+ return $status->{have} if $status->{have} and "$status->{have}" ne '<none>';
return '0 but true';
}
return $self->$method();
}
+# cuts the user-specified options out of the command-line args
sub cull_options {
my $self = shift;
- my $specs = $self->get_options or return ({}, @_);
+ my (@argv) = @_;
+
+ my $specs = $self->get_options;
+ return({}, @argv) unless($specs and %$specs); # no user options
+
require Getopt::Long;
# XXX Should we let Getopt::Long handle M::B's options? That would
# be easy-ish to add to @specs right here, but wouldn't handle options
$args->{$k} = $v->{default} if exists $v->{default};
}
- local @ARGV = @_; # No other way to dupe Getopt::Long
+ local @ARGV = @argv; # No other way to dupe Getopt::Long
# Get the options values and return them.
# XXX Add option to allow users to set options?
return $self->{args}{$key};
}
+# allows select parameters (with underscores) to be spoken with dashes
+# when used as command-line options
sub _translate_option {
my $self = shift;
my $opt = shift;
meta_merge
test_files
use_rcfile
+ use_tap_harness
+ tap_harness_args
); # normalize only selected option names
return $opt;
}
}
+# decide whether or not an option requires/has an opterand
sub _optional_arg {
my $self = shift;
my $opt = shift;
uninst
use_rcfile
verbose
+ sign
+ use_tap_harness
);
# inverted boolean options; eg --noverbose or --no-verbose
# we're punting a bit here, if an option appears followed by a digit
# we take the digit as the argument for the option. If there is
- # nothing that looks like a digit, we pretent the option is a flag
+ # nothing that looks like a digit, we pretend the option is a flag
# that is being set and has no argument.
my $arg = 1;
$arg = shift(@$argv) if @$argv && $argv->[0] =~ /^\d+$/;
sub read_args {
my $self = shift;
- my ($action, @argv);
+
(my $args, @_) = $self->cull_options(@_);
my %args = %$args;
my $opt_re = qr/[\w\-]+/;
+ my ($action, @argv);
while (@_) {
local $_ = shift;
if ( /^(?:--)?($opt_re)=(.*)$/ ) {
if ($key eq 'config') {
$self->config($_ => $val->{$_}) foreach keys %$val;
} else {
- my $add_to = ( $additive{$key} ? $self->{properties}{$key}
- : $self->valid_property($key) ? $self->{properties}
- : $self->{args});
+ my $add_to = $additive{$key} ? $self->{properties}{$key} :
+ $self->valid_property($key) ? $self->{properties} :
+ $self->{args} ;
if ($additive{$key}) {
$add_to->{$_} = $val->{$_} foreach keys %$val;
@types or croak "need some types of tests to check";
my %test_types = (
- default => '.t',
+ default => $p->{test_file_exts},
(defined($p->{test_types}) ? %{$p->{test_types}} : ()),
);
}
# we use local here because it ends up two method calls deep
- local $p->{test_file_exts} = [ @test_types{@types} ];
+ local $p->{test_file_exts} = [ map { ref $_ ? @$_ : $_ } @test_types{@types} ];
$self->depends_on('code');
# Protect others against our @INC changes
sub do_tests {
my $self = shift;
- my $p = $self->{properties};
- require Test::Harness;
-
- # Do everything in our power to work with all versions of Test::Harness
- my @harness_switches = $p->{debugger} ? qw(-w -d) : ();
- local $Test::Harness::switches = join ' ', grep defined, $Test::Harness::switches, @harness_switches;
- local $Test::Harness::Switches = join ' ', grep defined, $Test::Harness::Switches, @harness_switches;
- local $ENV{HARNESS_PERL_SWITCHES} = join ' ', grep defined, $ENV{HARNESS_PERL_SWITCHES}, @harness_switches;
-
- $Test::Harness::switches = undef unless length $Test::Harness::switches;
- $Test::Harness::Switches = undef unless length $Test::Harness::Switches;
- delete $ENV{HARNESS_PERL_SWITCHES} unless length $ENV{HARNESS_PERL_SWITCHES};
-
- local ($Test::Harness::verbose,
- $Test::Harness::Verbose,
- $ENV{TEST_VERBOSE},
- $ENV{HARNESS_VERBOSE}) = ($p->{verbose} || 0) x 4;
my $tests = $self->find_test_files;
- if (@$tests) {
+ if(@$tests) {
+ my $args = $self->tap_harness_args;
+ if($self->use_tap_harness or ($args and %$args)) {
+ $self->run_tap_harness($tests);
+ }
+ else {
+ $self->run_test_harness($tests);
+ }
+ }
+ else {
+ $self->log_info("No tests defined.\n");
+ }
+
+ $self->run_visual_script;
+}
+
+sub run_tap_harness {
+ my ($self, $tests) = @_;
+
+ require TAP::Harness;
+
+ # TODO allow the test @INC to be set via our API?
+
+ TAP::Harness->new({
+ lib => [@INC],
+ verbosity => $self->{properties}{verbose},
+ switches => [ $self->harness_switches ],
+ %{ $self->tap_harness_args },
+ })->runtests(@$tests);
+}
+
+sub run_test_harness {
+ my ($self, $tests) = @_;
+ require Test::Harness;
+ my $p = $self->{properties};
+ my @harness_switches = $self->harness_switches;
+
# Work around a Test::Harness bug that loses the particular perl
# we're running under. $self->perl is trustworthy, but $^X isn't.
local $^X = $self->perl;
+
+ # Do everything in our power to work with all versions of Test::Harness
+ local $Test::Harness::switches = join ' ', grep defined, $Test::Harness::switches, @harness_switches;
+ local $Test::Harness::Switches = join ' ', grep defined, $Test::Harness::Switches, @harness_switches;
+ local $ENV{HARNESS_PERL_SWITCHES} = join ' ', grep defined, $ENV{HARNESS_PERL_SWITCHES}, @harness_switches;
+
+ $Test::Harness::switches = undef unless length $Test::Harness::switches;
+ $Test::Harness::Switches = undef unless length $Test::Harness::Switches;
+ delete $ENV{HARNESS_PERL_SWITCHES} unless length $ENV{HARNESS_PERL_SWITCHES};
+
+ local ($Test::Harness::verbose,
+ $Test::Harness::Verbose,
+ $ENV{TEST_VERBOSE},
+ $ENV{HARNESS_VERBOSE}) = ($p->{verbose} || 0) x 4;
+
Test::Harness::runtests(@$tests);
- } else {
- $self->log_info("No tests defined.\n");
- }
+}
- # This will get run and the user will see the output. It doesn't
- # emit Test::Harness-style output.
- if (-e 'visual.pl') {
- $self->run_perl_script('visual.pl', '-Mblib='.$self->blib);
- }
+sub run_visual_script {
+ my $self = shift;
+ # This will get run and the user will see the output. It doesn't
+ # emit Test::Harness-style output.
+ $self->run_perl_script('visual.pl', '-Mblib='.$self->blib)
+ if -e 'visual.pl';
+}
+
+sub harness_switches {
+ shift->{properties}{debugger} ? qw(-w -d) : ();
}
sub test_files {
sub expand_test_dir {
my ($self, $dir) = @_;
- my $exts = $self->{properties}{test_file_exts} || ['.t'];
+ my $exts = $self->{properties}{test_file_exts};
return sort map { @{$self->rscan_dir($dir, qr{^[^.].*\Q$_\E$})} } @$exts
if $self->recursive_test_files;
sub localize_file_path {
my ($self, $path) = @_;
- $path =~ s/\.\z// if $self->is_vmsish;
return File::Spec->catfile( split m{/}, $path );
}
File::Spec->abs2rel( File::Spec->rel2abs( $file ),
File::Spec->rel2abs( $dir ) );
my $to_file =
- File::Spec->catdir( $ppm, 'blib',
+ File::Spec->catfile( $ppm, 'blib',
exists( $types{$type} ) ? $types{$type} : $type,
$rel_file );
$self->copy_if_modified( from => $file, to => $to_file );
sub do_create_makefile_pl {
my $self = shift;
require Module::Build::Compat;
- $self->delete_filetree('Makefile.PL');
$self->log_info("Creating Makefile.PL\n");
Module::Build::Compat->create_makefile_pl($self->create_makefile_pl, $self, @_);
$self->_add_to_manifest('MANIFEST', 'Makefile.PL');
\bblibdirs$
^MANIFEST\.SKIP$
+# Avoid VMS specific Makmaker generated files
+\bDescrip.MMS$
+\bDESCRIP.MMS$
+\bdescrip.mms$
+
# Avoid Module::Build generated and utility files.
\bBuild$
\bBuild.bat$
\b_build
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
# Avoid Devel::Cover generated files
\bcover_db
lgpl => 'http://opensource.org/licenses/lgpl-license.php',
bsd => 'http://opensource.org/licenses/bsd-license.php',
gpl => 'http://opensource.org/licenses/gpl-license.php',
+ gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
+ gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
mit => 'http://opensource.org/licenses/mit-license.php',
mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
open_source => undef,
AutoSplit::autosplit($file, $dir);
}
-sub _cbuilder {
+sub cbuilder {
# Returns a CBuilder object
my $self = shift;
my $p = $self->{properties};
return $p->{_cbuilder} if $p->{_cbuilder};
- return unless $self->_mb_feature('C_support');
+ die "Module::Build is not configured with C_support"
+ unless $self->_mb_feature('C_support');
require ExtUtils::CBuilder;
- return $p->{_cbuilder} = ExtUtils::CBuilder->new(config => $self->config);
+ return $p->{_cbuilder} = ExtUtils::CBuilder->new(
+ config => $self->config,
+ ($self->quiet ? (quiet => 1 ) : ()),
+ );
}
sub have_c_compiler {
return $p->{have_compiler} if defined $p->{have_compiler};
$self->log_verbose("Checking if compiler tools configured... ");
- my $b = $self->_cbuilder;
+ my $b = eval { $self->cbuilder };
my $have = $b && $b->have_compiler;
$self->log_verbose($have ? "ok.\n" : "failed.\n");
return $p->{have_compiler} = $have;
sub compile_c {
my ($self, $file, %args) = @_;
- my $b = $self->_cbuilder
- or die "Module::Build is not configured with C_support";
+ my $b = $self->cbuilder;
my $obj_file = $b->object_file($file);
$self->add_to_cleanup($obj_file);
my $module_name = $self->module_name;
$module_name ||= $spec->{module_name};
- my $b = $self->_cbuilder
- or die "Module::Build is not configured with C_support";
- $b->link(
+ $self->cbuilder->link(
module_name => $module_name,
objects => [$spec->{obj_file}, @$objects],
lib_file => $spec->{lib_file},
or die "Can't find ExtUtils::xsubpp in INC (@INC)";
my @typemaps;
- push @typemaps, Module::Build::ModuleInfo->find_module_by_name('ExtUtils::typemap', \@INC);
- my $lib_typemap = Module::Build::ModuleInfo->find_module_by_name('typemap', ['lib']);
- if (defined $lib_typemap and -e $lib_typemap) {
- push @typemaps, 'typemap';
- }
+ push @typemaps, Module::Build::ModuleInfo->find_module_by_name(
+ 'ExtUtils::typemap', \@INC
+ );
+ my $lib_typemap = Module::Build::ModuleInfo->find_module_by_name(
+ 'typemap', [File::Basename::dirname($file)]
+ );
+ push @typemaps, $lib_typemap if $lib_typemap;
@typemaps = map {+'-typemap', $_} @typemaps;
my $cf = $self->{config};
return Text::ParseWords::shellwords($string);
}
+sub oneliner {
+ # Returns a string that the shell can evaluate as a perl command.
+ # This should be avoided whenever possible, since "the shell" really
+ # means zillions of shells on zillions of platforms and it's really
+ # hard to get it right all the time.
+
+ # Some of this code is stolen with permission from ExtUtils::MakeMaker.
+
+ my($self, $cmd, $switches, $args) = @_;
+ $switches = [] unless defined $switches;
+ $args = [] unless defined $args;
+
+ # Strip leading and trailing newlines
+ $cmd =~ s{^\n+}{};
+ $cmd =~ s{\n+$}{};
+
+ my $perl = ref($self) ? $self->perl : $self->find_perl_interpreter;
+ return $self->_quote_args($perl, @$switches, '-e', $cmd, @$args);
+}
+
sub run_perl_script {
my ($self, $script, $preargs, $postargs) = @_;
foreach ($preargs, $postargs) {
perl(1), Module::Build(3)
=cut
-
-# vim:ts=8:sw=2:et:sta:sts=2
Revision history for Perl extension Module::Build.
+0.30 - Thu Sep 25 20:57:36 2008
+
+ - First non-beta release since April 2007. In the meantime, Sarkozy
+ became president of France, the 35W bridge fell in Minneapolis,
+ Phelps won a lot of gold, a new tribe of indigenous people was
+ discovered in the Amazon, and Bob Barker stopped doing The Price Is
+ Right. As of this moment though, the U.S. economy still hasn't
+ collapsed completely.
+
+0.2808_05 - Thu Sep 18 23:30:39 PDT 2008
+
+ - Skip test in t/ext.t which tickles shellwords() in Text::ParseWords
+ below 3.23 [David Wheeler, Ken]
+
+ - Fixed some shell-quoting issues in do_system() on Windows [Ken,
+ Schwern, reported by Curtis Jewell]
+
+ - Fixed t/xs.t failure for missing 'const char *' typemap in 5.6
+ [Schwern]
+
+ - Added build_requires for Test::More 0.49 and Test::Harness 2.03.
+ Removed bundled Test::More (was not working for 5.005x anyway).
+ [Schwern]
+
+ - Minimum required perl version is now 5.6.1. [Schwern]
+
+0.2808_04 - Thu Sep 11 22:51:27 PDT 2008
+
+ - Backed-out incompatible Module::Build::ModuleInfo change (first in
+ 0.2808_02.)
+
+0.2808_03 - Mon Sep 1 14:43:27 PDT 2008
+
+ - Made adjustments for the format changes of recent Test::Harness
+ output. [Nicholas Clark]
+
+ - Fixed the documentation for script_files to indicate that we search
+ bin/ for scripts by default. It has been this way for several
+ years. [Spotted by Ron Savage]
+
+0.2808_02 - Wed Jul 9 16:45:08 PDT 2008
+
+ - Experimental support for TAP::Harness with --use-tap-harness option
+ and the tap_harness_args property. [David Wheeler & Eric Wilhelm]
+
+ - Added test_file_exts property for main-run tests other than '*.t'.
+ [David Wheeler]
+
+ - Fixed getcwd()/rmtree() failure case on 5.10+mac where something is
+ unhappy about all of the tests deleting their distgen directory
+ before leaving it. [Eric Wilhelm & David Wheeler]
+
+ - Improved support for parsing qv() in modules' $VERSION
+ declarations, and made $VERSION-parsing errors more verbose. [Jos
+ Boumans]
+
+ - Integrated an omnibus patch for various VMS fixes. [Craig Berry &
+ John E. Malmberg]
+
+ - Some versions of Test::Harness (or something) seem to not be
+ stripping the ".t" suffix when outputting test reports, which was
+ causing one of our tests in t/compat.t to fail. Fixed. [Spotted by
+ a smoke tester]
+
+ - Most Unix platforms seem to allow hyphens in usernames, so we honor
+ this in our de-tilde-fying methods now. [Spotted by s-murata]
+
+ - If there are multiple assignments to the $VERSION variable in
+ someone's module and this generates warnings, tell the user what
+ line number the problem is at.
+
+ - Added 'gnu' and 'gnukfreebsd' as Unix variants. [Niko Tyni]
+
+ - Fixed a couple bugs in how we quote arguments to external processes
+ when they have to pass through the shell. Also much more
+ thoroughly tested our quoting now.
+
+ - Edited the Module::Build::API docs prose about the 'license' field
+ in response to some comments on the module-authors mailing list.
+
+ - Fixed a typo in some example code in the Cookbook. [Jeremy Leader]
+
+ - Custom typemaps were being looked for in places that don't quite
+ exist; fixed. [Michael G Schwern]
+
+ - QNX/Neutrino is now considered to be Unix. [rt.cpan.org 32214]
+
+ - Added 'gpl2' and 'gpl3' to the list of valid licenses. [Allen
+ Engelhardt]
+
+ - Fixed our Data::Dumper wrapper's sensitivity to users who might set
+ $Data::Dumper::Terse. [Spotted by Dominique Dumont]
+
+ - Documented the fix_shebang_line() method. [Elliot Shank]
+
+ - Applied the 'const' modifier to version() and xs_version() XS
+ functions we use during testing. [Robin Barker]
+
+ - Fixed processing of INC=, POLLUTE=, INSTALLDIRS=, and LIB= for
+ passthrough/small Makefile.PLs.
+
+ - perl Build.PL --sign=1 now signs. [Michael G Schwern]
+
+ - Fixed processing of INSTALLDIRS=whatever for compatibility
+ Makefiles. [Spotted by John Peacock]
+
+ - Zillions of special-cases have been added in Compat.pm for dealing
+ with the special Makefile system on VMS. [John E. Malmberg]
+
+ - Fixed some stuff in how VMS command-args get quoted. [John E. Malmberg]
+
+ - VMS now overrides localize_file_path() and localize_dir_path() so
+ we don't need to do special stuff in the general case. [John
+ E. Malmberg]
+
+ - Added a few more VMS-specific entries to the default MANIFEST.SKIP
+ file that (sometimes) gets created during the 'manifest'
+ action. [John E. Malmberg]
+
+ - Fixed a catdir() that should have been a catfile() when creating a
+ ppmdist. [John E. Malmberg]
+
+ - Removed some assumptions about what makefiles are called (not
+ necessarily "Makefile") and how they take their arguments, to get
+ VMS tests working better. [John E. Malmberg]
+
+ - Fixed our check for Archive::Tar in the t/runthrough.t test, which
+ fixes a common failure on Win32. [Spotted by Chris Williams]
+
+ - Fixed a File::Spec mal-ism in t/destinations.t [Craig A. Berry]
+
+ - Exposed the internal ExtUtils::CBuilder object as part of our API,
+ via the cbuilder() method. [Zefram]
+
+ - Upgraded to version.pm 0.74 (fixes bug #30004.)
+
+ - Overwrite core (post-5.9.4) Module::Build installs (bug #20528.)
+
+ - Pass quiet() option to ExtUtils::CBuilder object.
+
+0.2808_01 - Wed Oct 24 11:51:25 2007
+
- All .pm files in the Module-Build distribution (except for
M::B::Version.pm, which is kind of tied to version.pm) now have the
same $VERSION number explicitly specified.
- Added documentation for 'extra_linker_flags' parameter, and added a
corresponding 'extra_compiler_flags' parameter. [original patch by
Richard Clamp]
+
+ - The pass-through Makefile created by Module::Build::Compat now
+ supports MakeMaker options like POLLUTE=1 and INC. We also just
+ warn & skip when we see any unknown MM parameters, rather than
+ dying. [Dave Rolsky]
+
+ - Fixed an error about how @INC and $ENV{PERL5LIB} interact during
+ the testing of M::B itself. [jk <billy2000@fastmail.fm>]
+
+ - The pass-through Makefile doesn't include 'recommended' M::B
+ dependencies in the Makefile anymore, since they're not strictly
+ necessary. In particular, this makes installing M::B itself
+ easier.
+
+ - A new 'create_makefile_pl' parameter lets you use
+ Module::Build::Compat during the 'distdir' (or 'dist') action to
+ automatically create a Makefile.PL for compatibility with
+ ExtUtils::MakeMaker. The parameter's value should be one of the
+ styles named in the Module::Build::Compat documentation.
+
+ - When compiling C code, we now respect 'pollute' and 'inc'
+ parameters. (XXX - needs docs) [Dave Rolsky]
+
+ - Made the creation of the "install map" more generic. (XXX - needs
+ documentation)
+
+ - Fixed a problem in which add_to_cleanup() didn't note cleanup files
+ unless create_build_script() had been called already. [Dave Rolsky]
+
+ - During 'Build dist', we no longer have to load each .pm file (via
+ Module::Info) to determine the $VERSION numbers inside. Instead,
+ we call our internal version_from_file() method, which is the same
+ thing MakeMaker and PAUSE and search.cpan.org do. Also fixes a
+ failure when Module::Info is installed in a nonstandard directory.
+ [reported by Teun Burgers]
+
+ - Fixed some failing test code on Windows - open files can't be
+ deleted. [Andrew Savige]
+
+ - The Cygwin platform is now treated as a flavor of Unix rather than
+ a flavor of Windows. [chocolateboy]
+
+ - We're now more aggressive about adding temporary C compilation
+ files (*.c, *.bs) to the cleanup list. [Dave Rolsky]
+
+ - When constructing the list in META.yml of packages provided by this
+ distribution, we now use the same rules as the PAUSE scanner does
+ when a single .pm file contains multiple VERSIONs. [Andreas Koenig]
+
+ - check_installed_status() now works as both a class method and an
+ object method (and is documented so). [Spotted by Dave Rolsky]
+
+0.18 Tue Apr 8 13:24:23 CDT 2003
+
+ - We now rewrite the shebang lines of scripts ourselves, rather than
+ relying on MakeMaker routines to do it. MakeMaker changed the way
+ this happened (not the result, but where the code lived) a few
+ times. [Suggested by Richard Clamp]
+
+ - The scripts() method has changed to script_files(), and likewise
+ the 'scripts' parameter has changed to 'script_files'. The old
+ names can still be used for backward compatibility.
+
+ - Support for the 'scripts' parameter (which is now 'script_files')
+ was broken in 0.17, now it's fixed. [Richard Clamp]
+
+ - We now recommend ExtUtils::ParseXS 2.02, which will fail to load
+ with perl 5.005 or earlier (which is proper, because it doesn't
+ work with those versions). When it fails to load, we still fall
+ back to using the xsubpp script for XS parsing. [spotted by Dave
+ Rolsky, fix suggested by Richard Clamp]
+
+ - Now works on VMS - the Build script's shebang-line-equivalent
+ wasn't being formed correctly there - though just about everything
+ else worked fine. [Tested & patched by Michael Schwern]
+
+ - Eliminated a warning that occurred if 'perl Build.PL' or the
+ check_installed_status() method was run with -w. [Spotted by
+ Michael Schwern]
+
+0.17 Sat Mar 29 18:06:01 CST 2003
+
+ - Now works under perl 5.005_03. [Richard Clamp]
+
+ - When building blib/ , .PL files are now processed before doing
+ anything else. This means .PL files can be used in any of the
+ other contexts.
+
+ - The locating and processing of .pm, .pod, .xs, .PL files and script
+ files are now isolated into their own methods. This is aimed
+ toward providing a stable interface for this stuff, so they can be
+ overridden, parameterized, etc. They're not quite stable yet,
+ though.
+
+ - The internal lib_to_blib() method has gone away, because processing
+ is now done by smaller specialized methods. This method had some
+ duplicate assumptions about filenames that it's nice to get rid of.
+
+ - .PL files are no longer automatically processed in the c_source
+ directory, they must be specified manually in a 'PL_files'
+ parameter.
+
+ - Mention in the docs that it's useful to do "PL_FILES => {}" in a
+ Makefile.PL if you're using both a Makefile.PL and a
+ Build.PL. [Dom]
+
+ - Add several options to the 'license' field, so that we're in better
+ sync with PAUSE and CPAN options. [Andreas Koenig]
+
+ - Created a find_perl_interpreter() method that tries to locate the
+ currently executing perl interpreter. Following a suggestion from
+ Nicholas Clark <nick@ccl4.org> for Inline, we prefer an absolute
+ path in $^X, then an existent path in $Config{perlpath}, then
+ whatever's in $^X.
+
+ - Use the aforementioned perl to run scripts in run_perl_script().
+ This fixes the spurious warning "WARNING: Configuration was
+ initially created with 'foo', but we are now using 'bar'" that
+ appeared a lot in version 0.16.
+
+
+0.16 Mon Feb 24 13:06:47 CST 2003
+
+ - All three C compilers that perl supports on Windows environments
+ (MSVC, BCC, and GCC) are now supported by Module::Build. We now
+ reportedly pass all tests on Windows. [Randy W. Sims]
+
+ - The test t/xs.t, which tests building of XS modules, will be
+ skipped if no C compiler is found. [suggested by Randy W. Sims]
+
+ - The "install" action accepts new "destdir" [motivated by Michael
+ Schwern and Chip Salzenberg] and "uninst" parameters [by Dave
+ Rolsky]. The former prepends an arbitrary directory to all
+ installation paths (useful for package management), and the latter
+ will tell ExtUtils::Install to remove any differing files that are
+ "shadowing" the stuff you're installing from a different location,
+ just like MakeMaker's "make install UNINST=1" command will do.
+
+ - Made changes to the generated Makefile in Module::Build::Compat
+ that much better support Windows platforms [after suggestions by
+ James Freeman]
+
+ - Added experimental support for creating distribution SIGNATURE
+ files via Module::Signature. [Dave Rolsky]
+
+ - Added experimental support for installing via the "only.pm" module,
+ which allows loading specific versions of modules. Since this
+ module is so new, the interface may still be changing. [Brian
+ Ingerson]
+
+ - Added support for installing executable scripts, via the 'scripts'
+ parameter to new(), and the scripts() accessor method.
+
+ - Fix an infinite loop that occurred when doing 'perl Build.PL
+ config="foo=bar"'
+
+ - Fix up the formatting of the error message the user gets when
+ prereqs aren't satisfied.
+
+0.15 Fri Jan 17 15:00:24 CST 2003
+
+ - In link_c(), extra object files were mistakenly being treated as
+ output files, not input files, in the up-to-date check. Fixed.
+
+ - In up_to_date(), don't make an unnecessary copy of the file lists
+ when they're specified as array references.
+
+ - Split off the C compilation phase into its own method,
+ compile_support_files(), for easier subclassing.
+
+ - Start a stub of a 'manifypods' action.
+
+ - Compiler optimizations weren't being included in C compilation
+ statements. Fixed.
+
+ - The 'extra_linker_flags' parameter wasn't being honored. Fixed.
+
+ - The 'ccflags' Config.pm entry wasn't being properly split into
+ separate arguments. Fixed.
+
+
+0.14 Fri Dec 13 14:06:29 AEST 2002
+
+ - Added support for MacPerl (Mac OS version 9 and below), which (as
+ far as I know) was never natively supported by MakeMaker. Still
+ lacks support for the 'test' action (because Test::Harness
+ requires forking, which MacPerl won't do) and compiling XS/C files
+ (because I don't know how to invoke a compiler on MacOS, and one
+ may not even be available). This change is brought to you by
+ Michael Schwern and the letter '('.
+
+ - Improved processing of .xs files. Now we use the new
+ ExtUtils::ParseXS module if it's available, otherwise we use
+ backticks and write the result to a .c file ourselves. This
+ avoids the need to do cross-platform shell redirection.
+
+ - Make sure all parts of 'Build test' use the not-yet-installed
+ version of Module::Build. This only affects the tests for this
+ module, not any of the module code itself. [Spotted by Schwern]
+
+ - Oopsie - use $Config{ld} instead of $Config{cc} for linking.
+
+ - Added a 'diff' action, which is useful for comparing the details
+ of what you're about to install with what is already installed on
+ your system. This uses File::Compare, which is in the core.
+
+ - Fixed a problem on Windows in which the _build/ directory wasn't
+ getting deleted during the 'realclean' action, because we had a
+ file open in that directory. [Spotted by Michael Schwern]
+
+ - delete_filetree() now always uses File::Path::rmtree(), regardless
+ of whether the thing being deleted is a file or a directory. This
+ helps remove things on obscure platforms with strange locking
+ rules (or even not so obscure ones like MacOS). It also now
+ reports the number of files or directories deleted (without
+ recursing directory contents).
+
+ - rm_previous_build_script() is gone, replaced by calls to
+ delete_filetree().
+
+ - 'Build' now chdir()s in a BEGIN block, so the 'use Module::Build'
+ statement will work correctly. Solves a problem on MacOS, where
+ the 'Build' script may often be invoked from the wrong working
+ directory. [Fix by Michael Schwern]
+
+ - Internally we now use the multi-argument form of system() to run
+ external commands (such as 'diff' or 'cc') whenever possible (and
+ whenever we can't avoid system() altogether). Note that this
+ means we have to handle splitting some strings (such as
+ $Config{ccflags}) into argument lists like the shell would, which
+ is a drag. However, the alternative would be to handle shell
+ quoting of all arguments to commands ourselves, which is an even
+ bigger drag across platforms and involves arbitrary filenames and
+ so on.
+
+ - To handle the argument splitting mentioned above, a method
+ split_like_shell() has been created. So far it's just doing naive
+ processing. In practice, I've yet to actually see a %Config entry
+ that uses quotes & spaces, so the splitting task is usually not
+ very error-prone.
+
+ - The 'test' action now takes a 'test_files' parameter, similar to
+ the (undocumented) ExtUtils::MakeMaker TEST_FILES argument. Handy
+ during development when fixing bugs.
+
+ - Internally, the rscan_dir() method can now accept a predicate
+ function that decides whether a file/directory should be matched.
+
+ - We now issue a warning message when the author hasn't specified a
+ license type.
+
+0.13 Wed Nov 20 20:07:53 AEST 2002
+
+ - 'cleanup' file lists are now written immediately, rather than at
+ program termination. This helps avoid "phantom files" that don't
+ get handled by the 'realclean' action. The internal
+ write_cleanup() method (which was never documented) is now gone.
+
+ - The 'blib/' directory is now properly cleaned up in more (all?)
+ circumstances. Previously it could become a phantom if
+ create_build_script() was never called.
+
+ - Now scan the 'c_source' directory for .cpp (C++) files as well as
+ .c files, and compiles them.
+
+ - Use a 'phony' target for 'make manifest' in the pass-through
+ Makefile, for the same reason as 'make install' (see version 0.12
+ notes below).
+
+ - Module::Build::Compat now accepts any known Config.pm key and
+ passes it through to the Build.PL. Fixes a problem with CPANPLUS,
+ which was passing INSTALLMAN1DIR.
+
+ - The file 'META.yaml' has been re-named to 'META.yml' in order to
+ cooperate better with systems that can only handle 3 characters
+ after the dot.
+
+ - The t/xs.t test should give more informative error messages upon
+ failure.
+
+0.12 Thu Nov 14 18:31:47 AEST 2002
+
+ - The META.yaml file was erroneously looking for 'build_depends'
+ instead of 'build_requires'. [spotted by Iain Truskett]
+
+ - Add prompt() and y_n() methods for use in Build.PLs
+
+ - Do more to work with all versions of Test::Harness when setting
+ the TEST_VERBOSE flag and running under the debugger [patch by
+ Dave Rolsky]
+
+ - Include a test for verbosity handling
+
+ - Make sure the blib/ directory is always cleaned up with the
+ 'clean' or 'realclean' action.
+
+ - In a pass-through Makefile.PL, inform 'make' that 'install' is a
+ "fake target", so that it works properly on case-insensitive
+ filesystems like HFS+ with distributions that contain an INSTALL
+ file. [patch by Brian Ingerson]
+
+ - In Module::Build::Compat, show an example Makefile.PL that can
+ install Module::Build and re-invoke itself in one fell swoop [Dave
+ Rolsky and Autrijus Tang]
+
+ - Improve the formatting of the Module::Build and
+ Module::Build::Compat documentation.
+
+0.11 Fri Aug 23 18:50:46 AEST 2002
+
+ - 'module_version' and 'module_version_from' have been replaced by
+ 'dist_version' and 'dist_version_from', which is what they really
+ meant in the first place. 'dist_name' has been added.
+
+ - 'module_name' is now just a way to set 'dist_name' and
+ 'dist_version_from' in a convenient way.
+
+ - The 'name' in META.yaml is now the distribution name, not the
+ (incorrect) module name. [spotted by Graham Barr]
+
+ - Added the check_installed_status() and prereq_failures() methods
+ for checking prerequisite information with the programmatic
+ interface
+
+ - check_installed_version() now uses check_installed_status()
+ internally
+
+ - Documented the create_build_script() method, which had escaped
+ documentation.
+
+ - create_build_script() now writes prerequisite information to the
+ _build/ directory, for use by Module::Build::Compat.
+
+ - Module::Build::Compat has documentation for a safer way to write a
+ dummy Makefile.PL. [patch by Autrijus Tang]
+
+0.10 Wed Aug 7 19:36 2002
+ - Recommend YAML 0.35 instead of 0.30.
+
+ - Don't die during 'Build disttest' if YAML isn't installed. This
+ fixes tests 5-10 in runthrough.t if YAML isn't installed.
+
+ - Die if an unknown license type is used, but still default to
+ 'unknown' if no license is specified.
+
+ - Use YAML::DumpFile() if we're using a recent YAML,
+ YAML::StoreFile() otherwise.
+
+ - Show specific error messages in runthrough.t.
+
+ - Add a generated_by entry to the META.yaml file.
+
+ - Skip a few tests if YAML isn't installed.
+
+0.09 Fri Jun 28 11:07:08 EST 2002
+
+ - The 'distdir' action wasn't deleting the distribution directory
+ before building it again. This meant that, say, if you did 'Build
+ disttest' then 'Build dist', you'd end up with a blib/ directory
+ in your distribution. I actually had this happen for version
+ 0.08, and it's not nice to distribute a blib/ on CPAN.
+
+ - We now keep track of the 'base_dir', i.e. the top-level build
+ directory, so we can change back into it if we change out of it.
+ This necessitated a cwd() method, which uses the Cwd.pm module.
+ I'm aware of Cwd's limitations, particularly under taint-mode, but
+ I don't know a way around using it here.
+
+ - The 'dist_dir' action now changes back into 'base_dir' directory.
+
+ - We now do write_config() inside the create_build_script() method,
+ not inside the new() method.
+
+ - Simplified the find_version() method, and improved its error
+ messages.
+
+ - Renamed module_name_to_file() to find_module_by_name(), and added
+ a parameter specifying the directories to search in. Previously
+ we searched in 'lib' and @INC, which wasn't correct in all
+ situations.
+
+ - Patched the docs to change "Build test" to "./Build test"
+ [Elizabeth Mattijsen]
+
+0.08 Wed Jun 26 20:30:56 EST 2002
+
+ - Fixed the 'prereq' alias for the 'requires' parameter
+
+ - Added some tests in t/basic.t to test the dependency checking
+
+ - Added 'artistic' as a licensing option [Arthur Bergman]
+
+ - Fixed some bugs in requires/prereq/recommends/conflicts/build_depends
+
+ - Fixed a typo in the 'distclean' action that prevented its
+ execution [Arthur Bergman]
+
+ - Separated the linking phase of building XS items into its own
+ link_c() method. Its interface is still unstable, so it's not
+ documented yet. [suggested by Arthur Bergman]
+
+0.07 Jun 9 2002 15:46
+
+ - We now generate a 'META.yaml' metadata file during 'Build dist'.
+ This can be very useful for lots of things, none of which are
+ implemented yet.
+
+ - Added a 'dynamic_config' parameter, defaulting to false. This
+ lets distribution systems (CPAN.pm, etc.) build, test, and install
+ "easy" modules without having to execute the Build.PL at runtime.
+ It's also a guarantee that the list of dependencies is exactly
+ what is present in the metadata file, and won't be changed during
+ the build process.
+
+ - Added support for "recommended" and "build-time requirement"
+ modules, besides those that are absolutely required. Also added a
+ "conflicts" field.
+
+ - Changed the 'prereq' field to 'requires' (the old name will
+ continue to work).
+
+ - Added support for checking the installed version of perl as an
+ explicit dependency.
+
+ - Added a 'license' parameter to specify one of a fixed number of
+ licenses for the distribution.
+
+ - Fixed a bug in Module::Build::Compat that was preventing arguments
+ from being processed properly. [patch by Ilya Martynov]
+
+ - Make sure we're in the right directory when we write the cleanup
+ file, since various ExtUtils::Install errors might leave us in an
+ unknown directory. [patch by Ilya Martynov]
+
+ - Specified the 'license', 'recommends', and 'dynamic_config'
+ values in Build.PL, and changed 'prereq' to 'requires'.
+
+0.06 Apr 2 2002 17:44
+
+ - Added the Module::Build::Compat module for assisting and
+ explaining compatibility with ExtUtils::Makemaker and cohorts.
+
+ - State is now saved using Data::Dumper instead of my ad-hoc
+ mechanism, guaranteeing data integrity. Whitespace values broke
+ in the former scheme.
+
+ - Added the 'recommended' option, which works like 'prereq' but
+ isn't insistent.
+
+ - Separated the various parameters into three groups: parameters
+ that tell Module::Build what to do, Config.pm parameters, and
+ user-defined parameters for each build (the module author is the
+ 'user' here). This helps avoid conflicts between names, and it
+ was silly to have them all together. The three groups of
+ parameters are subject to the same rules for overriding: values
+ specified during a Build action take precedence over values
+ specified at 'perl Build.PL' time, which in turn take precedence
+ over values specified in the call to new().
+
+ - Improved support for .PL files. Any .PL file in the lib/
+ directory or the directory specified by 'c_source' will now get
+ properly executed. I also added a 'PL_files' parameter that you
+ can use in case the .PL doesn't create an obviously-named output
+ file.
+
+ - If a prerequisite condition is malformed, we now report a prereq
+ failure and say why. Previously we issued a warning and kept
+ going.
+
+
+0.05 10-Jan-2002 20:26
+ - Added the Module::Build->subclass() method, which makes it easier to
+ make quick-and-dirty subclasses of Module::Build.
+
+ - Reorganized the docs a bit.
+
+ - Added the 'testdb' action, and the 'debugger=1' argument to the
+ 'test' action, both of which run tests under the perl
+ debugger. (idea: Dave Rolsky)
+
+ - Added prerequisite checking (Dave Rolsky)
+
+ - Fixed an unlikely-to-occur bug with misquoted strings in the
+ 'Build' script (spot: Dave Rolsky)
+
+ - We're more careful about shush-ing warnings that
+ ExtUtils::Manifest might emit (Dave Rolsky)
+
+ - The 'help' action now auto-generates the list of actions (Dave Rolsky)
+
+ - Added the 'distcheck', 'skipcheck', 'distclean', 'distdir', and
+ 'disttest' actions (Dave Rolsky)
+
+ - We're a little more aggressive about cleaning up temporary files -
+ we'll try to clean them up even when we don't have write permission
+ on them. This isn't as dastardly as it sounds; if we /really/
+ don't have permission, we won't be able to remove them no matter
+ how hard we try.
+
+0.04 Fri Nov 16 16:55 2001
+ - Added a 'manifest' action. It's just like MakeMaker's 'make manifest', it
+ brings your MANIFEST file up to date with your distribution directory.
+
+ - Reorganized some of the responsibilities of various methods, which
+ allows modules to be built and tested programmatically.
+
+ - The 'clean' action will now clean up files that were created more
+ recently than the on-disk cleanup registry was written.
+
+ - Undefined values from Config.pm are handled correctly now.
+
+ - The dispatch() method will now accept explicit dispatch
+ parameters, for use in a programmatic setting.
+
+ - $ENV{TEST_VERBOSE} will be set in test scripts if the 'verbose=1'
+ parameter is set.
+
+ - Moved the test.pl script to t/basic.t
+
+ - Created the t/xs.t script, which tests building a module with a
+ .xs component.
+
+ - Fixed the loading of $^O-specific modules (there were no such
+ modules before).
+
+ - Added a 'darwin' platform module, which removes -flat_namespace
+ from $Config{ccflags} while building .xs modules (it's a linker
+ flag, not a compiler flag).
+
+ - Now uses $^W instead of the 'warnings' pragma, which apparently
+ provides compatibility with perl 5.005 (I've only tested it with
+ 5.6.x myself).
+
+ - If a file called C<visual.pl> exists in the top-level directory,
+ this file will be executed as a Perl script during 'Build test' and
+ its output will be shown to the user. This is a good place to put
+ speed tests or other tests that don't use the C<Test::Harness> format
+ for output.
+
+ - The 'Build install' step will now put .xs-related things in the
+ correct architecture-dependent libraries.
+
+ - Added the 'autosplit' option, even though I think autosplitting is
+ a load of hooie.
+
+0.03 Sun Nov 11 14:58 CDT 2001
+ - The 'perl Build.PL' step will now detect whether the current
+ environment is "unixish", "windowsish", etc., and load the correct
+ module (i.e. Module::Build::Platform::Unix). More specific
+ modules may also be written for particular values of $^O.
+
+ - Module::Build will now process any .xs files in the lib/
+ directory. Please let me know whether this works or not with your
+ distribution & platform. I'll be trying out various distributions
+ on my platform.
+
+ - Corrected some embarassing errors in the POD documentation. Also
+ added a long documentation section on the various build actions
+ (test, install, build, etc.) and added some neato ASCII art.
+
+ - Added a 'cleanup' mechanism - any method may call the
+ $self->add_to_cleanup(@files) method to register files which need
+ to be cleaned up during 'Build clean'.
+
+ - Added a 'Build help' action that gives a little syntax help, and
+ lists all the actions available.
+
+ - Fixed a bug in which 'blib/' wasn't properly being added to @INC
+ when running 'Build test'.
+
+ - For the 'Build dist' action, we'll use the 'tar' and 'gzip'
+ programs (as specified by Config.pm) on Unix platforms, otherwise
+ we'll use Archive::Tar and Compress::Zlib.
+
+0.02 Wed Sep 5 00:53:04 CDT 2001
+ - Added POD documentation.
+
+ - Added the 'install', 'fakeinstall', and 'dist' actions.
+
+ - new() will now determine version string based on 'module_version', or
+ 'module_version_from', or 'module_name', in that order.
+
+ - Module::Build::Base handles its file paths in a platform-independent
+ way, using the File:: modules
+
+
+0.01 Sun Aug 5 01:23:10 2001
+ - original version; created by h2xs 1.1.1.4 with options -XA -n Module::Build
+
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
use File::Spec;
use IO::File;
use Module::Build::ModuleInfo;
use Data::Dumper;
+my %convert_installdirs = (
+ PERL => 'core',
+ SITE => 'site',
+ VENDOR => 'vendor',
+);
+
my %makefile_to_build =
(
TEST_VERBOSE => 'verbose',
VERBINST => 'verbose',
- INC => sub { map {('--extra_compiler_flags', $_)} Module::Build->split_like_shell(shift) },
- POLLUTE => sub { ('--extra_compiler_flags', '-DPERL_POLLUTE') },
- INSTALLDIRS => sub {local $_ = shift; 'installdirs=' . (/^perl$/ ? 'core' : $_) },
- LIB => sub { ('--install_path', 'lib='.shift()) },
+ INC => sub { map {(extra_compiler_flags => $_)} Module::Build->split_like_shell(shift) },
+ POLLUTE => sub { (extra_compiler_flags => '-DPERL_POLLUTE') },
+ INSTALLDIRS => sub { (installdirs => $convert_installdirs{uc shift()}) },
+ LIB => sub {
+ my $lib = shift;
+ my %config = (
+ installprivlib => $lib,
+ installsitelib => $lib,
+ installarchlib => "$lib/$Config{archname}",
+ installsitearch => "$lib/$Config{archname}"
+ );
+ return map { (config => "$_=$config{$_}") } keys %config;
+ },
+
+ # Convert INSTALLVENDORLIB and friends.
+ (
+ map {
+ my $name = "INSTALL".$_."LIB";
+ $name => sub {
+ my @ret = (config => { lc $name => shift });
+ print STDERR "# Converted to @ret\n";
+
+ return @ret;
+ }
+ } keys %convert_installdirs
+ ),
# Some names they have in common
map {$_, lc($_)} qw(DESTDIR PREFIX INSTALL_BASE UNINST),
);
+my %macro_to_build = %makefile_to_build;
+# "LIB=foo make" is not the same as "perl Makefile.PL LIB=foo"
+delete $macro_to_build{LIB};
sub create_makefile_pl {
$fh = $args{fh};
} else {
$args{file} ||= 'Makefile.PL';
+ local $build->{properties}{quiet} = 1;
+ $build->delete_filetree($args{file});
$fh = IO::File->new("> $args{file}") or die "Can't write $args{file}: $!";
}
}
# If a *bundled* custom subclass is being used, make sure we add its
- # directory to @INC.
+ # directory to @INC. Also, lib.pm always needs paths in Unix format.
my $subclass_load = '';
if (ref($build) ne "Module::Build") {
my $subclass_dir = $package->subclass_dir($build);
if ($build->dir_contains($base_dir, $subclass_dir)) {
$subclass_dir = File::Spec->abs2rel($subclass_dir, $base_dir);
+ $subclass_dir = $package->unixify_dir($subclass_dir);
$subclass_load = "use lib '$subclass_dir';";
}
+ # Otherwise, leave it the empty string
} else {
+ $subclass_dir = $package->unixify_dir($subclass_dir);
$subclass_load = "use lib '$subclass_dir';";
}
}
|| File::Spec->catdir($build->config_dir, 'lib'));
}
+sub unixify_dir {
+ my ($self, $path) = @_;
+ return join '/', File::Spec->splitdir($path);
+}
+
sub makefile_to_build_args {
- shift;
+ my $class = shift;
my @out;
foreach my $arg (@_) {
next if $arg eq '';
die "Malformed argument '$arg'");
# Do tilde-expansion if it looks like a tilde prefixed path
- ( $val ) = glob( $val ) if $val =~ /^~/;
+ ( $val ) = Module::Build->_detildefy( $val ) if $val =~ /^~/;
if (exists $makefile_to_build{$key}) {
my $trans = $makefile_to_build{$key};
- push @out, ref($trans) ? $trans->($val) : ("--$trans", $val);
+ push @out, $class->_argvify( ref($trans) ? $trans->($val) : ($trans => $val) );
} elsif (exists $Config{lc($key)}) {
- push @out, '--config', lc($key) . "=$val";
+ push @out, $class->_argvify( config => lc($key) . "=$val" );
} else {
# Assume M::B can handle it in lowercase form
- push @out, "--\L$key", $val;
+ push @out, $class->_argvify("\L$key" => $val);
}
}
return @out;
}
+sub _argvify {
+ my ($self, @pairs) = @_;
+ my @out;
+ while (@pairs) {
+ my ($k, $v) = splice @pairs, 0, 2;
+ push @out, ("--$k", $v);
+ }
+ return @out;
+}
+
sub makefile_to_build_macros {
my @out;
- while (my ($macro, $trans) = each %makefile_to_build) {
+ while (my ($macro, $trans) = each %macro_to_build) {
# On some platforms (e.g. Cygwin with 'make'), the mere presence
# of "EXPORT: FOO" in the Makefile will make $ENV{FOO} defined.
# Therefore we check length() too.
my $class = $args{build_class};
my $perl = $class->find_perl_interpreter;
+
+ # VMS MMS/MMK need to use MCR to run the Perl image.
+ $perl = 'MCR ' . $perl if $self->_is_vms_mms;
+
my $noop = ($class->is_windowsish ? 'rem>nul' :
- $class->is_vmsish ? 'Continue' :
+ $self->_is_vms_mms ? 'Continue' :
'true');
- my $Build = 'Build --makefile_env_macros 1';
- # Start with a couple special actions
+ my $filetype = $class->is_vmsish ? '.COM' : '';
+
+ my $Build = 'Build' . $filetype . ' --makefile_env_macros 1';
+ my $unlink = $class->oneliner('1 while unlink $ARGV[0]', [], [$args{makefile}]);
+ $unlink =~ s/\$/\$\$/g;
+
my $maketext = <<"EOF";
all : force_do_it
$perl $Build
realclean : force_do_it
$perl $Build realclean
- $perl -e unlink -e shift $args{makefile}
+ $unlink
force_do_it :
@ $noop
EOF
}
- $maketext .= "\n.EXPORT : " . join(' ', keys %makefile_to_build) . "\n\n";
+ if ($self->_is_vms_mms) {
+ # Roll our own .EXPORT as MMS/MMK don't honor that directive.
+ $maketext .= "\n.FIRST\n\t\@ $noop\n";
+ for my $macro (keys %macro_to_build) {
+ $maketext .= ".IFDEF $macro\n\tDEFINE $macro \"\$($macro)\"\n.ENDIF\n";
+ }
+ $maketext .= "\n";
+ }
+ else {
+ $maketext .= "\n.EXPORT : " . join(' ', keys %macro_to_build) . "\n\n";
+ }
return $maketext;
}
sub write_makefile {
my ($pack, %in) = @_;
- $in{makefile} ||= 'Makefile';
+
+ unless (exists $in{build_class}) {
+ warn "Unknown 'build_class', defaulting to 'Module::Build'\n";
+ $in{build_class} = 'Module::Build';
+ }
+ my $class = $in{build_class};
+ $in{makefile} ||= $pack->_is_vms_mms ? 'Descrip.MMS' : 'Makefile';
+
open MAKE, "> $in{makefile}" or die "Cannot write $in{makefile}: $!";
print MAKE $pack->fake_prereqs;
print MAKE $pack->fake_makefile(%in);
close MAKE;
}
+sub _is_vms_mms {
+ return Module::Build->is_vmsish && ($Config{make} =~ m/MM[SK]/i);
+}
+
1;
__END__
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Config;
package Module::Build::Cookbook;
+use strict;
+use vars qw($VERSION);
+$VERSION = '0.30';
=head1 NAME
# Process pod files first
my @e = @{$build->build_elements};
- my $i = grep {$e[$_] eq 'pod'} 0..$#e;
+ my ($i) = grep {$e[$_] eq 'pod'} 0..$#e;
unshift @e, splice @e, $i, 1;
Currently, C<build_elements> has the following default value:
package Module::Build::Dumper;
+use strict;
+use vars qw($VERSION);
+$VERSION = '0.30';
# This is just a split-out of a wrapper function to do Data::Dumper
# stuff "the right way". See:
sub _data_dump {
my ($self, $data) = @_;
return ("do{ my "
- . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
+ . Data::Dumper->new([$data],['x'])->Purity(1)->Terse(0)->Dump()
. '$x; }')
}
+# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
+# vim:ts=8:sw=2:et:sta:sts=2
package Module::Build::ModuleInfo;
# This module provides routines to gather information about
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use File::Spec;
use Module::Build::Version;
-my $PKG_REGEXP = qr/ # match a package declaration
+my $PKG_REGEXP = qr{ # match a package declaration
^[\s\{;]* # intro chars on a line
package # the word 'package'
\s+ # whitespace
([\w:]+) # a package name
\s* # optional whitespace
; # semicolon line terminator
-/x;
+}x;
-my $VARNAME_REGEXP = qr/ # match fully-qualified VERSION name
+my $VARNAME_REGEXP = qr{ # match fully-qualified VERSION name
([\$*]) # sigil - $ or *
(
( # optional leading package name
)?
VERSION
)\b
-/x;
+}x;
-my $VERS_REGEXP = qr/ # match a VERSION definition
+my $VERS_REGEXP = qr{ # match a VERSION definition
(?:
\(\s*$VARNAME_REGEXP\s*\) # with parens
|
)
\s*
=[^=~] # = but not ==, nor =~
-/x;
+}x;
sub new_from_file {
- my $package = shift;
+ my $class = shift;
my $filename = File::Spec->rel2abs( shift );
+
return undef unless defined( $filename ) && -f $filename;
- return $package->_init( undef, $filename, @_ );
+ return $class->_init(undef, $filename, @_);
}
sub new_from_module {
- my $package = shift;
+ my $class = shift;
my $module = shift;
my %props = @_;
+
$props{inc} ||= \@INC;
- my $filename = $package->find_module_by_name( $module, $props{inc} );
+ my $filename = $class->find_module_by_name( $module, $props{inc} );
return undef unless defined( $filename ) && -f $filename;
- return $package->_init( $module, $filename, %props );
+ return $class->_init($module, $filename, %props);
}
sub _init {
- my $package = shift;
+ my $class = shift;
my $module = shift;
my $filename = shift;
-
my %props = @_;
+
my( %valid_props, @valid_props );
@valid_props = qw( collect_pod inc );
@valid_props{@valid_props} = delete( @props{@valid_props} );
warn "Unknown properties: @{[keys %props]}\n" if scalar( %props );
my %data = (
- module => $module,
- filename => $filename,
- version => undef,
- packages => [],
- versions => {},
+ module => $module,
+ filename => $filename,
+ version => undef,
+ packages => [],
+ versions => {},
pod => {},
pod_headings => [],
collect_pod => 0,
%valid_props,
);
- my $self = bless( \%data, $package );
+ my $self = bless(\%data, $class);
$self->_parse_file();
- unless ( $self->{module} && length( $self->{module} ) ) {
- my( $v, $d, $f ) = File::Spec->splitpath( $self->{filename} );
- if ( $f =~ /\.pm$/ ) {
+ unless($self->{module} and length($self->{module})) {
+ my ($v, $d, $f) = File::Spec->splitpath($self->{filename});
+ if($f =~ /\.pm$/) {
$f =~ s/\..+$//;
my @candidates = grep /$f$/, @{$self->{packages}};
- $self->{module} = shift( @candidates ); # punt
- } else {
- if ( grep /main/, @{$self->{packages}} ) {
- $self->{module} = 'main';
- } else {
+ $self->{module} = shift(@candidates); # punt
+ }
+ else {
+ if(grep /main/, @{$self->{packages}}) {
+ $self->{module} = 'main';
+ }
+ else {
$self->{module} = $self->{packages}[0] || '';
}
}
# class method
sub _do_find_module {
- my $package = shift;
+ my $class = shift;
my $module = shift || die 'find_module_by_name() requires a package name';
my $dirs = shift || \@INC;
my $pod_data = '';
while (defined( my $line = <$fh> )) {
+ my $line_num = $.;
chomp( $line );
next if $line =~ /^\s*#/;
# that we should watch out for...)
warn <<"EOM" unless $line =~ /=\s*eval/;
Package '$vers_pkg' already declared with version '$vers{$vers_pkg}',
-ignoring subsequent declaration.
+ignoring subsequent declaration on line $line_num.
EOM
}
} else {
warn <<"EOM";
Package '$pkg' already declared with version '$vers{$pkg}'
-ignoring new version '$v'.
+ignoring new version '$v' on line $line_num.
EOM
}
$self->{pod_headings} = \@pod;
}
+{
+my $pn = 0;
sub _evaluate_version_line {
my $self = shift;
my( $sigil, $var, $line ) = @_;
# We compile into $vsub because 'use version' would cause
# compiletime/runtime issues with local()
my $vsub;
+ $pn++; # everybody gets their own package
my $eval = qq{BEGIN { q# Hide from _packages_inside()
- #; package Module::Build::ModuleInfo::_version;
+ #; package Module::Build::ModuleInfo::_version::p$pn;
+ use Module::Build::Version;
no strict;
local $sigil$var;
if $@;
(ref($vsub) eq 'CODE') or
die "failed to build version sub for $self->{filename}";
- my $result = $vsub->();
+ my $result = eval { $vsub->() };
+
+ die "Could not get version from $self->{filename} by executing:\n$eval\n\nThe fatal error was: $@\n" if $@;
# Bless it into our own version class
$result = Module::Build::Version->new($result);
return $result;
}
+}
############################################################
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Data::Dumper;
use IO::File;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
# This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use vars qw(@ISA);
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
sub _detildefy {
my ($self, $value) = @_;
- $value =~ s[^~(\w*)(?=/|$)] # tilde with optional username
+ $value =~ s[^~(\w[-\w]*)?(?=/|$)] # tilde with optional username
[$1 ?
((getpwnam $1)[7] || "~$1") :
(getpwuid $>)[7]
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
? 1
: 0;
- map { $_ = q(").$_.q(") if !/^\"/ && length($_) > 0 }
- ($got_arrayref ? @{$args[0]}
- : @args
- );
+ # Do not quote qualifiers that begin with '/'.
+ map { if (!/^\//) {
+ $_ =~ s/\"/""/g; # escape C<"> by doubling
+ $_ = q(").$_.q(");
+ }
+ }
+ ($got_arrayref ? @{$args[0]}
+ : @args
+ );
return $got_arrayref ? $args[0]
: join(' ', @args);
sub find_perl_interpreter { return $^X; }
+=item localize_file_path
+
+Convert the file path to the local syntax
+
+=cut
+
+sub localize_file_path {
+ my ($self, $path) = @_;
+ $path =~ s/\.\z//;
+ return VMS::Filespec::vmsify($path);
+}
+
+=item localize_dir_path
+
+Convert the directory path to the local syntax
+
+=cut
+
+sub localize_dir_path {
+ my ($self, $path) = @_;
+ return VMS::Filespec::vmspath($path);
+}
+
=back
=head1 AUTHOR
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Config;
}
+sub _quote_args {
+ # Returns a string that can become [part of] a command line with
+ # proper quoting so that the subprocess sees this same list of args.
+ my ($self, @args) = @_;
+
+ my @quoted;
+
+ for (@args) {
+ if ( /^[^\s*?!\$<>;|'"\[\]\{\}]+$/ ) {
+ # Looks pretty safe
+ push @quoted, $_;
+ } else {
+ # XXX this will obviously have to improve - is there already a
+ # core module lying around that does proper quoting?
+ s/"/\\"/g;
+ push @quoted, qq("$_");
+ }
+ }
+
+ return join " ", @quoted;
+}
+
+
sub split_like_shell {
# As it turns out, Windows command-parsing is very different from
# Unix command-parsing. Double-quotes mean different things,
return @argv;
}
+
+# system(@cmd) does not like having double-quotes in it on Windows.
+# So we quote them and run it as a single command.
+sub do_system {
+ my ($self, @cmd) = @_;
+
+ my $cmd = $self->_quote_args(@cmd);
+ my $status = system($cmd);
+ if ($status and $! =~ /Argument list too long/i) {
+ my $env_entries = '';
+ foreach (sort keys %ENV) { $env_entries .= "$_=>".length($ENV{$_})."; " }
+ warn "'Argument list' was 'too long', env lengths are $env_entries";
+ }
+ return !$status;
+}
+
+
1;
__END__
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.2808_01';
+$VERSION = '0.30';
$VERSION = eval $VERSION;
use vars qw(@ISA);
use strict;
use vars qw($VERSION);
-$VERSION = 0.7203;
+$VERSION = 0.74;
eval "use version $VERSION";
if ($@) { # can't locate version files, use our own
1;
# replace everything from here to the end with the current version/vpp.pm
-
package version::vpp;
use strict;
use locale;
use vars qw ($VERSION @ISA @REGEXS);
-$VERSION = 0.7203;
+$VERSION = 0.74;
push @REGEXS, qr/
^v? # optional leading 'v'
'nomethod' => \&vnoop,
);
+my $VERSION_MAX = 0x7FFFFFFF;
+
+eval "use warnings";
+if ($@) {
+ eval '
+ package warnings;
+ sub enabled {return $^W;}
+ 1;
+ ';
+}
+
sub new
{
my ($class, $value) = @_;
my $alpha = 0;
my $width = 3;
my $saw_period = 0;
+ my $vinf = 0;
my ($start, $last, $pos, $s);
$s = 0;
while ( substr($value,$pos,1) =~ /[._\d]/ ) {
if ( substr($value,$pos,1) eq '.' ) {
if ($alpha) {
- require Carp;
Carp::croak("Invalid version format ".
- "(underscores before decimal)");
+ "(underscores before decimal)");
}
$saw_period++;
$last = $pos;
if ($alpha) {
require Carp;
Carp::croak("Invalid version format ".
- "(multiple underscores)");
+ "(multiple underscores)");
}
$alpha = 1;
$width = $pos - $last - 1; # natural width of sub-version
if ( $alpha && !$saw_period ) {
require Carp;
- Carp::croak("Invalid version format (alpha without decimal)");
+ Carp::croak("Invalid version format ".
+ "(alpha without decimal)");
}
if ( $alpha && $saw_period && $width == 0 ) {
require Carp;
- Carp::croak("Invalid version format (misplaced _ in number)");
+ Carp::croak("Invalid version format ".
+ "(misplaced _ in number)");
}
if ( $saw_period > 1 ) {
$qv = 1; # force quoted version processing
}
+ $last = $pos;
$pos = $s;
if ( $qv ) {
$orev = $rev;
$rev += substr($value,$s,1) * $mult;
$mult /= 10;
- if ( abs($orev) > abs($rev) ) {
- require Carp;
- Carp::croak("Integer overflow in version");
+ if ( abs($orev) > abs($rev)
+ || abs($rev) > abs($VERSION_MAX) ) {
+ if ( warnings::enabled("overflow") ) {
+ require Carp;
+ Carp::carp("Integer overflow in version");
+ }
+ $s = $end - 1;
+ $rev = $VERSION_MAX;
}
$s++;
if ( substr($value,$s,1) eq '_' ) {
$orev = $rev;
$rev += substr($value,$end,1) * $mult;
$mult *= 10;
- if ( abs($orev) > abs($rev) ) {
- require Carp;
- Carp::croak("Integer overflow in version");
+ if ( abs($orev) > abs($rev)
+ || abs($rev) > abs($VERSION_MAX) ) {
+ if ( warnings::enabled("overflow") ) {
+ require Carp;
+ Carp::carp("Integer overflow in version");
+ }
+ $end = $s - 1;
+ $rev = $VERSION_MAX;
}
}
}
}
if ( substr($value,$pos) ) { # any remaining text
- warn "Version string '$value' contains invalid data; ".
- "ignoring: '".substr($value,$pos)."'";
+ if ( warnings::enabled("misc") ) {
+ require Carp;
+ Carp::carp("Version string '$value' contains invalid data; ".
+ "ignoring: '".substr($value,$pos)."'");
+ }
}
# cache the original value for use when stringification
- $self->{original} = substr($value,0,$pos);
+ if ( $vinf ) {
+ $self->{vinf} = 1;
+ $self->{original} = 'v.Inf';
+ }
+ else {
+ $self->{original} = substr($value,0,$pos);
+ }
return ($self);
}
package Module::Build::YAML;
use strict;
-
use vars qw($VERSION @EXPORT @EXPORT_OK);
$VERSION = "0.50";
@EXPORT = ();
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest tests => 52;
-use Cwd ();
-my $cwd = Cwd::cwd;
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
#########################
-use_ok 'Module::Build';
-
-SKIP: {
- skip "no blib in core", 1 if $ENV{PERL_CORE};
- like $INC{'Module/Build.pm'}, qr/\bblib\b/, "Make sure Module::Build was loaded from blib/";
-}
-
-
# Test object creation
{
my $mb = Module::Build->new( module_name => $dist->name );
$mb->add_to_cleanup('save_out');
# Use uc() so we don't confuse the current test output
like uc(stdout_of( sub {$mb->dispatch('test', verbose => 1)} )), qr/^OK \d/m;
- like uc(stdout_of( sub {$mb->dispatch('test', verbose => 0)} )), qr/\.\.OK/;
+ like uc(stdout_of( sub {$mb->dispatch('test', verbose => 0)} )), qr/\.\. ?OK/;
$mb->dispatch('realclean');
$dist->clean;
is $args{foo}, 1;
# revert test distribution to pristine state because we modified a file
- chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
$dist = DistGen->new( dir => $tmp );
$dist->regen;
- chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+ $dist->chdir_in;
}
# Test author stuff
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
delete @ENV{@makefile_keys};
my @makefile_types = qw(small passthrough traditional);
-my $tests_per_type = 14;
-if ( $Config{make} && find_in_path($Config{make}) ) {
- plan tests => 38 + @makefile_types*$tests_per_type*2;
+my $tests_per_type = 15;
+
+#find_in_path does not understand VMS.
+
+if ( $Config{make} && $^O ne 'VMS' ? find_in_path($Config{make}) : 1 ) {
+ plan tests => 34 + @makefile_types*$tests_per_type*2;
} else {
plan skip_all => "Don't know how to invoke 'make'";
}
-ok 1, "Loaded";
+
+my $is_vms_mms = ($^O eq 'VMS') && ($Config{make} =~ /MM[SK]/i);
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
#########################
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
# Create test distribution; set requires and build_requires
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
#########################
my @make = $Config{make} eq 'nmake' ? ('nmake', '-nologo') : ($Config{make});
+my $makefile = 'Makefile';
+
+# VMS MMK/MMS by convention use Descrip.MMS
+if ($is_vms_mms) {
+ $makefile = 'Descrip.MMS';
+}
+
+
#########################
# Test without requires
# in older-generated Makefile.PLs
my $warning = '';
local $SIG{__WARN__} = sub { $warning = shift; };
- my $maketext = eval { Module::Build::Compat->fake_makefile(makefile => 'Makefile') };
+
+ my $maketext = eval { Module::Build::Compat->fake_makefile(makefile => $makefile) };
is $@, '', "fake_makefile lived";
like $maketext, qr/^realclean/m, "found 'realclean' in fake_makefile output";
like $warning, qr/build_class/, "saw warning about 'build_class'";
# Make sure various Makefile.PL arguments are supported
Module::Build::Compat->create_makefile_pl('passthrough', $mb);
- my $libdir = File::Spec->catdir( $cwd, 't', 'libdir' );
+ my $libdir = File::Spec->catdir( $tmp, 'libdir' );
my $result;
stdout_of( sub {
$result = $mb->run_perl_script('Makefile.PL', [],
like $output, qr/(?:# ok \d+\s+)+/, 'Should be verbose';
# Make sure various Makefile arguments are supported
- $output = stdout_of( sub { $ran_ok = $mb->do_system(@make, 'test', 'TEST_VERBOSE=0') } );
+ my $make_macro = 'TEST_VERBOSE=0';
+
+ # VMS MMK/MMS macros use different syntax.
+ if ($is_vms_mms) {
+ $make_macro = '/macro=("' . $make_macro . '")';
+ }
+
+ $output = stdout_of( sub {
+ $ran_ok = $mb->do_system(@make, 'test', $make_macro)
+ } );
+
ok $ran_ok, "make test without verbose ran ok";
$output =~ s/^/# /gm; # Don't confuse our own test output
like $output,
- qr/(?:# .+basic\.+ok\s+(?:[\d.]+\s*m?s\s*)?(?:# \[[\d:]+\]\s*)?)# All tests/,
- 'Should be non-verbose';
+ qr/# .+basic(\.t)?[.\s#]+ok[.\s#]+All tests successful/,
+ 'Should be non-verbose';
- $mb->delete_filetree($libdir);
- ok ! -e $libdir, "Sample installation directory should be cleaned up";
+ (my $libdir2 = $libdir) =~ s/libdir/lbiidr/;
+ my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2");
+
+ if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax.
+ $make_args[0] = '/macro=("' . join('","',@make_args) . '")';
+ pop @make_args while scalar(@make_args) > 1;
+ }
+ ($output) = stdout_stderr_of(
+ sub {
+ $ran_ok = $mb->do_system(@make, 'fakeinstall', @make_args);
+ }
+ );
+
+ ok $ran_ok, "make fakeinstall with INSTALLDIRS=vendor ran ok";
+ $output =~ s/^/# /gm; # Don't confuse our own test output
+ like $output,
+ qr/\Q$libdir2\E .* Simple\.pm/x,
+ 'Should have installdirs=vendor';
stdout_of( sub { $mb->do_system(@make, 'realclean'); } );
- ok ! -e 'Makefile', "Makefile shouldn't exist";
+ ok ! -e $makefile, "$makefile shouldn't exist";
1 while unlink 'Makefile.PL';
ok ! -e 'Makefile.PL', "Makefile.PL cleaned up";
+
+ 1 while unlink $libdir, $libdir2;
}
{ # Make sure tilde-expansion works
unlike $b2->install_base, qr/^~/, "Tildes should be expanded";
stdout_of( sub { $mb->do_system(@make, 'realclean'); } );
- ok ! -e 'Makefile', "Makefile shouldn't exist";
+ ok ! -e $makefile, "$makefile shouldn't exist";
1 while unlink 'Makefile.PL';
ok ! -e 'Makefile.PL', "Makefile.PL cleaned up";
}
+# cleanup
+$dist->remove;
+
#########################################################
sub test_makefile_types {
$label .= " (postargs: $postargs)";
}
ok $result, $label;
- ok -e 'Makefile', "Makefile exists";
+ ok -e $makefile, "$makefile exists";
if ($cleanup) {
$output = stdout_of( sub {
$build->do_system(@make, 'realclean');
});
- ok ! -e 'Makefile', "Makefile cleaned up";
+ ok ! -e '$makefile', "$makefile cleaned up";
}
else {
pass '(skipping cleanup)'; # keep test count constant
my %requires = %{ $_[0] };
delete $requires{perl}; # until EU::MM supports this
SKIP: {
- skip 'Makefile not found', 1 unless -e 'Makefile';
+ skip "$makefile not found", 1 unless -e $makefile;
my $prereq_pm = find_makefile_prereq_pm();
is_deeply $prereq_pm, \%requires,
- "Makefile has correct PREREQ_PM line";
+ "$makefile has correct PREREQ_PM line";
}
}
# Following subroutine adapted from code in CPAN.pm
# by Andreas Koenig and A. Speer.
sub find_makefile_prereq_pm {
- my $fh = IO::File->new( 'Makefile', 'r' )
- or die "Can't read Makefile: $!";
+ my $fh = IO::File->new( $makefile, 'r' )
+ or die "Can't read $makefile: $!";
my $req = {};
local($/) = "\n";
while (<$fh>) {
}
return $req;
}
-
-# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
-$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 113;
+use MBTest tests => 115;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
use Config;
# We need to create a well defined environment to test install paths.
# We do this by setting up appropriate Config entries.
-use Module::Build;
my @installstyle = qw(lib perl5);
my $mb = Module::Build->new_from_context(
installdirs => 'site',
}
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
+use Module::Build;
+
my @unix_splits =
(
{ q{one t'wo th'ree f"o\"ur " "five" } => [ 'one', 'two three', 'fo"ur ', 'five' ] },
{ q{ foo bar } => [ 'foo', 'bar' ] },
+ { q{ D\'oh f\{g\'h\"i\]\* } => [ "D'oh", "f{g'h\"i]*" ] },
+ { q{ D\$foo } => [ 'D$foo' ] },
+ { qq{one\\\ntwo} => [ "one\ntwo" ] }, # TODO
);
my @win_splits =
{ 'a " b " c' => [ 'a', ' b ', 'c' ] },
);
-plan tests => 10 + 2*@unix_splits + 2*@win_splits;
+plan tests => 10 + 4*@unix_splits + 4*@win_splits;
-#########################
+ensure_blib('Module::Build');
-use Module::Build;
-ok(1);
+#########################
# Should always return an array unscathed
foreach my $platform ('', '::Platform::Unix', '::Platform::Windows') {
is "@result", "foo bar baz", "Split using $pkg";
}
+# I think 3.24 isn't actually the majik version, my 3.23 seems to pass...
+my $low_TPW_version = Text::ParseWords->VERSION < 3.24;
use Module::Build::Platform::Unix;
foreach my $test (@unix_splits) {
+ # Text::ParseWords bug:
+ local $TODO = $low_TPW_version && ((keys %$test)[0] =~ m{\\\n});
+
do_split_tests('Module::Build::Platform::Unix', $test);
}
}
{
+ # Make sure data can make a round-trip through an external perl
+ # process, which can involve the shell command line
+
+ # Holy crap, I can't believe this works:
+ local $Module::Build{properties}{quiet} = 1;
+
+ my @data = map values(%$_), @unix_splits, @win_splits;
+ for my $d (@data) {
+ my $out = stdout_of
+ ( sub {
+ Module::Build->run_perl_script('-le', [], ['print join " ", map "{$_}", @ARGV', @$d]);
+ } );
+ chomp $out;
+ is($out, join(' ', map "{$_}", @$d), "perl round trip for ".join('',map "{$_}", @$d));
+ }
+}
+
+{
+ # Make sure data can make a round-trip through an external backtick
+ # process, which can involve the shell command line
+
+ local $Module::Build{properties}{quiet} = 1;
+ my @data = map values(%$_), @unix_splits, @win_splits;
+ for my $d (@data) {
+ chomp(my $out = Module::Build->_backticks('perl', '-le', 'print join " ", map "{$_}", @ARGV', @$d));
+ is($out, join(' ', map "{$_}", @$d), "backticks round trip for ".join('',map "{$_}", @$d));
+ }
+}
+
+{
# Make sure run_perl_script() propagates @INC
my $dir = 'whosiewhatzit';
mkdir $dir, 0777;
local @INC = ($dir, @INC);
- my $output = stdout_of( sub { Module::Build->run_perl_script('', ['-le', 'print for @INC']) } );
+ my $output = stdout_of( sub { Module::Build->run_perl_script('-le', [], ['print for @INC']) } );
like $output, qr{^$dir}m;
rmdir $dir;
}
is( 0 + grep( !defined(), @result ), # all defined
0,
"'$string' result all defined" );
- is_deeply(\@result, $expected);
+ is_deeply(\@result, $expected) or
+ diag("$package split_like_shell error \n" .
+ ">$string< is not splitting as >" . join("|", @$expected) . '<');
}
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 65;
+use MBTest tests => 66;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
#########################
-use Module::Build;
-ok 1;
-
# Here we make sure actions are only called once per dispatch()
$::x = 0;
my $mb = Module::Build->subclass
}
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 6;
+use MBTest tests => 8;
-use Cwd ();
-my $cwd = Cwd::cwd;
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+use IO::File;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
-use IO::File;
-
-use Module::Build;
my $mb = Module::Build->new_from_context;
my @files;
}
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest 'no_plan';#tests => 0;
+use MBTest tests => 25;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
use Cwd ();
use File::Path ();
chdir($dist->dirname) or die "Can't chdir to '@{[$dist->dirname]}': $!";
-use_ok 'Module::Build';
-
########################################################################
{ # check the =item style
my $mb = Module::Build->subclass(
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 34;
+use MBTest tests => 36;
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+use Config;
use Cwd ();
my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
#########################
-use Module::Build;
-use Config;
-
$dist->add_file( 'script', <<'---' );
#!perl -w
is keys %$pms, 0;
# revert to pristine state
- chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
$dist = DistGen->new( dir => $tmp );
$dist->regen;
- chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+ $dist->chdir_in;
}
sub strip_volume {
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
$VERBOSE = 0;
+use Carp;
+
use Cwd ();
use File::Basename ();
use File::Find ();
use Data::Dumper;
BEGIN {
- if( $^O eq 'VMS' ) {
- # For things like vmsify()
- require VMS::Filespec;
- VMS::Filespec->import;
- }
+ if( $^O eq 'VMS' ) {
+ # For things like vmsify()
+ require VMS::Filespec;
+ VMS::Filespec->import;
+ }
}
BEGIN {
require Exporter;
);
}
+sub undent {
+ my ($string) = @_;
+
+ my ($space) = $string =~ m/^(\s+)/;
+ $string =~ s/^$space//gm;
+
+ return($string);
+}
+########################################################################
+
sub new {
my $package = shift;
my %options = @_;
);
my $self = bless( \%data, $package );
+ # So we can clean up later even if the caller chdir()s
+ $self->{dir} = File::Spec->rel2abs($self->{dir});
+
tie %{$self->{filedata}}, 'Tie::CPHash';
tie %{$self->{pending}{change}}, 'Tie::CPHash';
return $self;
}
-# not a method
-sub undent {
- my ($string) = @_;
-
- my ($space) = $string =~ m/^(\s+)/;
- $string =~ s/^$space//gm;
-
- return($string);
-}
-
sub _gen_default_filedata {
my $self = shift;
RETVAL
---
+ # 5.6 is missing const char * in its typemap
+ $self->$add_unless('typemap', undent(<<" ---"));
+ const char * T_PV
+ ---
+
$self->$add_unless('t/basic.t', undent(<<" ---"));
use Test::More tests => 2;
use strict;
sub remove {
my $self = shift;
- File::Path::rmtree( File::Spec->canonpath($self->dirname) );
+ croak("invalid usage -- remove()") if(@_);
+ $self->chdir_original if($self->did_chdir);
+ File::Path::rmtree( $self->dirname );
+ # might as well check
+ croak("\nthis test should have used chdir_in()") unless(Cwd::getcwd);
}
sub revert {
$self->{pending}{change}{$file} = 1;
}
+sub chdir_in {
+ my $self = shift;
+
+ $self->{original_dir} ||= Cwd::cwd; # only once
+ my $dir = $self->dirname;
+ chdir($dir) or die "Can't chdir to '$dir': $!";
+}
+########################################################################
+
+sub did_chdir {
+ my $self = shift;
+
+ return exists($self->{original_dir});
+}
+########################################################################
+
+sub chdir_original {
+ my $self = shift;
+
+ croak("never called chdir_in()") unless($self->{original_dir});
+ my $dir = $self->{original_dir};
+ chdir($dir) or die "Can't chdir to '$dir': $!";
+}
+########################################################################
+
1;
__END__
If the optional C<clean> argument is given, it also removes any
extraneous files that do not belong to the distribution.
+=head2 chdir_in
+
+Change directory into the dist root.
+
+ $dist->chdir_in;
+
+=head2 chdir_original
+
+Returns to whatever directory you were in before chdir_in() (regardless
+of the cwd.)
+
+ $dist->chdir_original;
+
=head3 clean()
Removes any files that are not part of the distribution.
# Make sure none of our tests load the users ~/.modulebuildrc file
$ENV{MODULEBUILDRC} = 'NONE';
- # In case the test wants to use Test::More or our other bundled
- # modules, make sure they can be loaded. They'll still do "use
- # Test::More" in the test script.
+ # In case the test wants to use our other bundled
+ # modules, make sure they can be loaded.
my $t_lib = File::Spec->catdir('t', 'bundled');
unless ($ENV{PERL_CORE}) {
find_in_path
check_compiler
have_module
+ ensure_blib
);
push @EXPORT, @extra_exports;
__PACKAGE__->export(scalar caller, @extra_exports);
sub tmpdir { $tmp }
END {
if(-d $tmp) {
- File::Path::rmtree($tmp) or warn "cannot clean dir '$tmp'";
+ # Go back to where you came from!
+ chdir $cwd or die "Couldn't chdir to $cwd";
+ File::Path::rmtree($tmp) or diag "cannot clean dir '$tmp'";
}
}
}
return eval "use $module; 1";
}
+sub ensure_blib {
+ # Make sure the given module was loaded from blib/, not the larger system
+ my $mod = shift;
+ (my $path = $mod) =~ s{::}{/}g;
+
+ SKIP: {
+ skip "no blib in core", 1 if $ENV{PERL_CORE};
+ like $INC{"$path.pm"}, qr/\bblib\b/, "Make sure $mod was loaded from blib/";
+ }
+}
+
1;
# vim:ts=2:sw=2:et:sta
use Module::Build::ConfigData;
if ( Module::Build::ConfigData->feature('manpage_support') ) {
- plan tests => 21;
+ plan tests => 22;
} else {
plan skip_all => 'manpage_support feature is not enabled';
}
+ensure_blib('Module::Build');
+
#########################
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
use File::Spec::Functions qw( catdir );
my $destdir = catdir($cwd, 't', 'install_test' . $$);
# revert to a pristine state
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
$dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
my $mb2 = Module::Build->new(
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest 'no_plan';
+use_ok 'Module::Build::YAML';
+ensure_blib('Module::Build::YAML');
+
my ($dir);
$dir = ".";
$dir = "t" if (-d "t");
{
- use_ok("Module::Build::YAML");
my ($expected, $got, $var);
##########################################################
# Test a typical-looking Module::Build structure (alphabetized)
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 49;
+use MBTest tests => 51;
-use Cwd ();
-my $cwd = Cwd::cwd;
-my $tmp = MBTest->tmpdir;
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+my $tmp = MBTest->tmpdir;
-use Module::Build;
use Module::Build::ConfigData;
my %metadata =
}
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
use Module::Build;
my $mb = Module::Build->new_from_context;
############################################################
# cleanup
-chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 18;
+use MBTest tests => 20;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
-use Module::Build;
use Module::Build::ConfigData;
use DistGen;
my $dist = DistGen->new( dir => $tmp, skip_manifest => 1 );
$dist->regen;
- chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+ $dist->chdir_in;
ok ! -e 'MANIFEST';
ok -e 'META.yml';
- chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
}
});
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
# .pm File with pod
############################################################
# cleanup
-chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
#!/usr/bin/perl -w
+# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
+# vim:ts=8:sw=2:et:sta:sts=2
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 81;
+use MBTest tests => 82;
+
+use_ok 'Module::Build::ModuleInfo';
+ensure_blib('Module::Build::ModuleInfo');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
#########################
-
-use_ok( 'Module::Build::ModuleInfo' );
-
# class method C<find_module_by_name>
my $module = Module::Build::ModuleInfo->find_module_by_name(
'Module::Build::ModuleInfo' );
}
# revert to pristine state
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
$dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
# Find each package only once
ok( $pm_info->version > 1.23, 'alpha version greater than non');
# revert to pristine state
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
$dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
# parse $VERSION lines scripts for package main
# cleanup
-chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 2;
+use MBTest tests => 4;
-use Cwd ();
-my $cwd = Cwd::cwd;
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+use IO::File;
my $tmp = MBTest->tmpdir;
use DistGen;
$dist->add_file("$libdir/Build.PL", 'die');
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
-use IO::File;
-use Module::Build;
unshift(@INC, $libdir);
my $mb = eval { Module::Build->new_from_context};
ok($mb);
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-use File::Path;
-rmtree( $tmp );
-
# vim:ts=2:sw=2:et:sta
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 11;
+use MBTest tests => 13;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
-
+$dist->chdir_in;
-use Module::Build;
###################################
$dist->change_file( 'Build.PL', <<"---" );
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 27;
+use MBTest tests => 28;
-#########################
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Module::Build;
-ok(1);
+#########################
package Foo;
sub foo;
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 7;
+use MBTest tests => 8;
-use Cwd ();
-my $cwd = Cwd::cwd;
+use_ok 'Module::Build::PodParser';
+ensure_blib('Module::Build::PodParser');
#########################
-use_ok 'Module::Build::PodParser';
-
{
package IO::StringBased;
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
+
use Module::Build;
use Module::Build::ConfigData;
my $manpage_support = Module::Build::ConfigData->feature('manpage_support');
my $HTML_support = Module::Build::ConfigData->feature('HTML_support');
-
{
my ($have_c_compiler, $C_support_feature) = check_compiler();
if (! $C_support_feature) {
} elsif ( $^O eq 'VMS' ) {
plan skip_all => "Needs porting work on VMS";
} else {
- plan tests => 12;
+ plan tests => 13;
}
}
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
});
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
use File::Spec::Functions qw(catdir);
}
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-use File::Path;
-rmtree( $tmp );
-
########################################
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest tests => 32;
-use Module::Build;
-use Module::Build::ConfigData;
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+use Module::Build::ConfigData;
my $have_yaml = Module::Build::ConfigData->feature('YAML_support');
#########################
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
---
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
-
-#########################
+$dist->chdir_in;
-use Module::Build;
-ok(1);
-
-SKIP: {
- skip "no blib in core", 1 if $ENV{PERL_CORE};
- like $INC{'Module/Build.pm'}, qr/\bblib\b/, "Make sure version from blib/ is loaded";
-}
#########################
SKIP: {
skip( "not sure if we can create a tarball on this platform", 1 )
- unless $mb->check_installed_status('Archive::Tar', 0) ||
+ unless $mb->check_installed_version('Archive::Tar', 0) ||
$mb->isa('Module::Build::Platform::Unix');
$mb->add_to_cleanup($mb->dist_dir . ".tar.gz");
ok ! -e $mb->config_dir;
ok ! -e $mb->dist_dir;
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
SKIP: {
$dist->add_file( 'bin/script.bat', $script_data );
$dist->regen;
- chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+ $dist->chdir_in;
$mb = Module::Build->new_from_context;
ok $mb;
my $out = slurp( $script_file );
is $out, $script_data, ' unmodified by pl2bat';
- chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
}
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
--- /dev/null
+#!/usr/bin/perl -w
+# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
+# vim:ts=8:sw=2:et:sta:sts=2
+
+use strict;
+use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
+use MBTest 'no_plan';
+
+use DistGen qw(undent);
+
+use Module::Build;
+
+# XXX DistGen shouldn't be assuming module-ness?
+my $dist = DistGen->new(dir => MBTest->tmpdir);
+$dist->add_file('bin/foo', undent(<<' ---'));
+ #!/usr/bin/perl
+
+ package bin::foo;
+ $VERSION = 0.01;
+
+ =head1 NAME
+
+ foo - does stuff
+
+ =head1 AUTHOR
+
+ A. U. Thor, a.u.thor@a.galaxy.far.far.away
+
+ =cut
+
+ print "hello world\n";
+ ---
+
+my %details = (
+ dist_name => 'bin-foo',
+ dist_version_from => 'bin/foo',
+ dist_author => ['A. U. Thor, a.u.thor@a.galaxy.far.far.away'],
+ dist_version => '0.01',
+);
+my %meta_provides = (
+ 'bin-foo' => {
+ file => 'bin/foo',
+ version => '0.01',
+ }
+);
+$dist->change_build_pl({
+ # TODO need to get all of this data out of the program itself
+ ! $ENV{EXTRA_TEST} ? (
+ %details, meta_merge => { provides => \%meta_provides, },
+ ) : (),
+ program_name => 'bin/foo',
+ license => 'perl',
+});
+
+# hmm... the old assumption of what a dist looks like is wrong here
+$dist->remove_file('lib/Simple.pm'); $dist->regen;
+
+$dist->chdir_in;
+rmdir('lib');
+
+#system('konsole');
+my $mb = Module::Build->new_from_context;
+ok($mb);
+is($mb->program_name, 'bin/foo');
+is($mb->license, 'perl');
+is($mb->dist_name, 'bin-foo');
+is($mb->dist_version, '0.01');
+is_deeply($mb->dist_author,
+ ['A. U. Thor, a.u.thor@a.galaxy.far.far.away']);
+ok $mb->dispatch('distmeta');
+
+use Module::Build::ConfigData;
+SKIP: {
+ skip( 'YAML_support feature is not enabled', 1 )
+ unless Module::Build::ConfigData->feature('YAML_support');
+ require YAML;
+ my $yml = YAML::LoadFile('META.yml');
+ is_deeply($yml->{provides}, \%meta_provides);
+}
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 8;
+use MBTest tests => 9;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
#########################
-use_ok 'Module::Build';
-
# Here we make sure we can define an action that will test a particular type
$::x = 0;
my $mb = Module::Build->subclass(
my $output = uc(stdout_of(
sub {$mb->dispatch('testspecial', verbose => 0)}
));
-like($output, qr/\.\.OK/);
+like($output, qr/\.\. ?OK/);
is($::x, 3, "called a third time");
-chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
$dist->remove;
# vim:ts=4:sw=4:et:sta
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 14 + 12;
+use MBTest tests => 15 + 12;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd();
my $tmp = MBTest->tmpdir;
use DistGen;
---
$dist->regen;
-
-chdir($dist->dirname) or die "Can't chdir to '@{[$dist->dirname]}': $!";
-
+$dist->chdir_in;
#########################
-use_ok 'Module::Build';
-
my $mb = Module::Build->subclass(
code => q#
sub ACTION_testspecial {
is(scalar(@{[$all_output =~ m/OK/mg]}), 8 );
is(scalar(@{[$all_output =~ m/ALL TESTS SUCCESSFUL\./mg]}), 1);
-chdir($cwd) or die "Can't chdir to '$cwd': $!";
$dist->remove;
{ # once-again
ok 1;
---
$dist->regen;
-
-chdir($dist->dirname) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
my $mb = Module::Build->subclass(
code => q#
is(scalar(@{[$all_output =~ m/(OK 1)/mg]}), 5 );
is(scalar(@{[$all_output =~ m/(OK)/mg]}), 13 );
-chdir($cwd) or die "Can't chdir to '$cwd': $!";
$dist->remove;
} # end once-again
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 15;
+use MBTest tests => 17;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
-
+$dist->chdir_in;
-use Module::Build;
sub run_sample {
my @args = @_;
SKIP: {
my $home = $ENV{HOME} ? $ENV{HOME} : undef;
- skip "Needs case and syntax tweaks for VMS", 14 if $^O eq 'VMS';
+
+ if ($^O eq 'VMS') {
+ # Convert the path to UNIX format, trim off the trailing slash
+ $home = VMS::Filespec::unixify($home);
+ $home =~ s#/$##;
+ }
+
unless (defined $home) {
my @info = eval { getpwuid $> };
skip "No home directory for tilde-expansion tests", 14 if $@;
# Again, with named users
SKIP: {
- skip "Needs case and syntax tweaks for VMS", 1 if $^O eq 'VMS';
my @info = eval { getpwuid $> };
skip "No home directory for tilde-expansion tests", 1 if $@;
my ($me, $home) = @info[0,7];
- is( run_sample( $p => "~$me/foo")->$p(), "$home/foo" );
+ my $expected = "$home/foo";
+
+ if ($^O eq 'VMS') {
+ # Convert the path to UNIX format and trim off the trailing slash
+ $home = VMS::Filespec::unixify($home);
+ $home =~ s#/$##;
+ $expected = $home . '/../[^/]+' . '/foo';
+ }
+
+ like( run_sample( $p => "~$me/foo")->$p(), qr($expected)i );
}
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 2;
+use MBTest tests => 4;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
#########################
-use Module::Build;
-
my @mod = split( /::/, $dist->name );
my $file = File::Spec->catfile( $dist->dirname, 'lib', @mod ) . '.pm';
is( Module::Build->version_from_file( $file ), '0.01', 'version_from_file' );
# cleanup
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );
} elsif ( $^O eq 'VMS' ) {
plan skip_all => 'Child test output confuses harness';
} else {
- plan tests => 22;
+ plan tests => 23;
}
}
+ensure_blib('Module::Build');
+
+
#########################
-use Cwd ();
-my $cwd = Cwd::cwd;
my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp, xs => 1 );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
my $mb = Module::Build->new_from_context;
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
$dist = DistGen->new( name => 'Simple::With::Deep::Name',
dir => $tmp, xs => 1 );
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
$mb = Module::Build->new_from_context;
is $@, '';
is $@, '';
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
---
$dist->regen;
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+$dist->chdir_in;
$mb = Module::Build->new_from_context;
is $@, '';
# cleanup
-chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
$dist->remove;
-
-use File::Path;
-rmtree( $tmp );