use Cwd ();
my $cwd = Cwd::cwd;
-my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' );
+my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
$dist->remove_file( 't/basic.t' );
-$dist->change_file( 'Build.PL', <<'---' );
-use Module::Build;
-
-my $build = new Module::Build(
+$dist->change_build_pl
+({
module_name => 'Simple',
scripts => [ 'script' ],
license => 'perl',
requires => { 'File::Spec' => 0 },
-);
-$build->create_build_script;
----
+});
+
$dist->add_file( 'script', <<'---' );
#!perl -w
print "Hello, World!\n";
my $blib_script = File::Spec->catfile( qw( blib script script ) );
ok -e $blib_script;
- SKIP: {
+ SKIP: {
skip("We do not rewrite shebang on VMS", 1) if $^O eq 'VMS';
- my $fh = IO::File->new($blib_script);
- my $first_line = <$fh>;
- isnt $first_line, "#!perl -w\n", "should rewrite the shebang line";
+ my $fh = IO::File->new($blib_script);
+ my $first_line = <$fh>;
+ isnt $first_line, "#!perl -w\n", "should rewrite the shebang line";
}
}
---
$dist = DistGen->new( dir => $tmp );
- $dist->change_file( 'Build.PL', <<'---' );
-use Module::Build;
-my $build = new Module::Build(
- module_name => 'Simple',
- scripts => [ 'bin/script.bat' ],
- license => 'perl',
-);
-$build->create_build_script;
----
+ $dist->change_build_pl({
+ module_name => 'Simple',
+ scripts => [ 'bin/script.bat' ],
+ license => 'perl',
+ });
+
$dist->add_file( 'bin/script.bat', $script_data );
$dist->regen;