Author: schwern
Date: Tue Jun 16 13:17:27 2009
New Revision: 12852
Added:
Module-Build/trunk/t/PL_files.t
Modified:
Module-Build/trunk/MANIFEST
Module-Build/trunk/lib/Module/Build/API.pod
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
[rt.cpan.org 46991] Don't instll PL_files in bin
Modified: Module-Build/trunk/MANIFEST
==============================================================================
--- Module-Build/trunk/MANIFEST (original)
+++ Module-Build/trunk/MANIFEST Tue Jun 16 13:17:27 2009
@@ -59,6 +59,7 @@
t/notes.t
t/par.t
t/parents.t
+t/PL_files.t
t/pod_parser.t
t/ppm.t
t/runthrough.t
Modified: Module-Build/trunk/lib/Module/Build/API.pod
==============================================================================
--- Module-Build/trunk/lib/Module/Build/API.pod (original)
+++ Module-Build/trunk/lib/Module/Build/API.pod Tue Jun 16 13:17:27 2009
@@ -614,6 +614,9 @@
print "Hello, world!\n";
END
+PL files are not installed by default, so its safe to put them in
+F<lib/> and F<bin/>.
+
=item pm_files
@@ -716,7 +719,7 @@
or as a string giving the name of a single script file.
The default is to install any scripts found in a F<bin> directory at
-the top level of the distribution.
+the top level of the distribution, minus any keys of L<PL_files>.
For backward compatibility, you may use the parameter C<scripts>
instead of C<script_files>. Please consider this usage deprecated,
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Tue Jun 16 13:17:27 2009
@@ -3467,7 +3467,8 @@
return $_ = {$_ => 1};
}
- return $_ = { map {$_,1} $self->_files_in('bin') };
+ my $pl_files = $self->PL_files || {};
+ return $_ = { map {$_ => 1} grep !$pl_files->{$_}, $self->_files_in('bin') };
}
BEGIN { *scripts = \&script_files; }
Added: Module-Build/trunk/t/PL_files.t
==============================================================================
--- (empty file)
+++ Module-Build/trunk/t/PL_files.t Tue Jun 16 13:17:27 2009
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
+use MBTest tests => 6;
+use DistGen;
+use Module::Build;
+
+
+# Set up a distribution for testing
+my $dist;
+{
+ $dist = DistGen->new( dir => MBTest->tmpdir );
+ $dist->regen;
+ $dist->chdir_in;
+
+ my $distname = $dist->name;
+ $dist->change_build_pl({
+ module_name => $distname,
+ PL_files => {
+ 'bin/foo.PL' => 'bin/foo',
+ 'lib/Bar.pm.PL' => 'lib/Bar.pm',
+ },
+ });
+
+ $dist->add_file("bin/foo.PL", <<'END');
+open my $fh, ">", $ARGV[0] or die $!;
+print $fh "foo\n";
+END
+
+ $dist->add_file("lib/Bar.pm.PL", <<'END');
+open my $fh, ">", $ARGV[0] or die $!;
+print $fh "bar\n";
+END
+
+ $dist->regen;
+}
+
+
+# Test that PL files don't get installed even in bin or lib
+{
+ my $mb = Module::Build->new_from_context( install_base => "test_install" );
+ $mb->dispatch("install");
+
+ ok -e "test_install/bin/foo", "Generated PL_files installed from bin";
+ ok -e "test_install/lib/perl5/Bar.pm", " and from lib";
+
+ ok !-e "test_install/bin/foo.PL", "PL_files not installed from bin";
+ ok !-e "test_install/lib/perl5/Bar.pm.PL", " nor from lib";
+
+ is slurp("test_install/bin/foo"), "foo\n", "Generated bin contains correct content";
+ is slurp("test_install/lib/perl5/Bar.pm"), "bar\n", " so does the lib";
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.