Update of /cvsroot/module-build/Module-Build/lib/Module/Build
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18584/lib/Module/Build
Modified Files:
Authoring.pod Base.pm
Log Message:
Build will now chdir() to the right directory first
Index: Base.pm
===================================================================
RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v
retrieving revision 1.529
retrieving revision 1.530
diff -u -d -r1.529 -r1.530
--- Base.pm 29 Nov 2005 05:03:09 -0000 1.529
+++ Base.pm 29 Nov 2005 05:18:40 -0000 1.530
@@ -562,6 +562,9 @@
# Set the build class.
$self->{properties}{build_class} ||= ref $self;
+ # If there was no orig_dir, set to the same as base_dir
+ $self->{properties}{orig_dir} ||= $self->{properties}{base_dir};
+
my $defaults = $self->valid_properties_defaults;
foreach my $prop (keys %$defaults) {
@@ -643,6 +646,7 @@
license
mb_version
module_name
+ orig_dir
perl
pm_files
pod_files
@@ -1159,15 +1163,13 @@
use Cwd;
use File::Spec;
+my \$orig_dir;
BEGIN {
\$^W = 1; # Use warnings
- my \$curdir = File::Spec->canonpath( Cwd::cwd() );
- \$curdir = uc \$curdir if $case_tolerant;
- my \$is_same_dir = \$^O eq 'MSWin32' ? (Win32::GetShortPathName(\$curdir) eq '$q{base_dir}')
- : (\$curdir eq '$q{base_dir}');
- unless (\$is_same_dir) {
- die ('This script must be run from $q{base_dir}, not '.\$curdir."\\n".
- "Please re-run the Build.PL script here.\\n");
+ \$orig_dir = Cwd::cwd();
+ my \$base_dir = '$q{base_dir}';
+ unless (chdir(\$base_dir)) {
+ die ("Couldn't chdir(\$base_dir), aborting\\n");
}
unshift \@INC,
(
@@ -1189,6 +1191,7 @@
my \$build = $build_package->resume (
properties => {
config_dir => '$q{config_dir}',
+ orig_dir => \$orig_dir,
},
);
Index: Authoring.pod
===================================================================
RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Authoring.pod,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- Authoring.pod 22 Nov 2005 10:40:43 -0000 1.24
+++ Authoring.pod 29 Nov 2005 05:18:40 -0000 1.25
@@ -1061,6 +1061,13 @@
instead of called from a shell), and lasts until C<perl Build.PL> is
run again or the C<clean> action is run.
+=item orig_dir()
+
+Returns a string containing the working directory that was in effect
+before the F<Build> script chdir()-ed into the C<base_dir>. This
+might be useful for writing wrapper tools that might need to chdir()
+back out.
+
=item runtime_params()
=item runtime_params($key)
|