Author: dagolden
Date: Thu Sep 3 19:50:31 2009
New Revision: 13269
Modified:
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
treat relative cpan-client path as relative to perl
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 Thu Sep 3 19:50:31 2009
@@ -3165,10 +3165,22 @@
}
}
-
my ($command, @opts) = $self->split_like_shell($self->cpan_client);
- # TODO possibly check whether $command is a perl script (search the
- # PATH) and use run_perl_command().
+
+ # relative command should be relative to our active Perl
+ # so we need to locate that command
+ if ( ! File::Spec->file_name_is_absolute( $command ) ) {
+ my @bindirs = File::Basename::dirname($self->perl);
+ push @bindirs, map {$self->config->{"install${_}bin"}} '','site','vendor';
+ for my $d ( @bindirs ) {
+ my $abs_cmd = File::Spec->catfile( $d, $command );
+ if ( -x $abs_cmd ) {
+ $command = $abs_cmd;
+ last;
+ }
+ }
+ }
+
$self->do_system($command, @opts, @install);
}