Permalink
Browse files

Don't try absolute path twice

  • Loading branch information...
1 parent 6340d6d commit d447276873cc2e948e9090936cb1809a52270241 @Leont committed Oct 16, 2012
Showing with 4 additions and 7 deletions.
  1. +1 −0 Changes
  2. +3 −7 lib/Devel/FindPerl.pm
View
@@ -2,6 +2,7 @@ Revision history for Devel-FindPerl
{{$NEXT}}
Cache the results of find_perl_interpreter
+ Don't try absolute path twice
0.005 2012-10-06 00:14:49 Europe/Amsterdam
Explicitly load File::Basename
View
@@ -29,13 +29,9 @@ sub _discover_perl_interpreter {
my @potential_perls;
# Try 1, Check $^X for absolute path
- push @potential_perls, $perl if File::Spec->file_name_is_absolute($perl);
+ push @potential_perls, File::Spec->file_name_is_absolute($perl) ? $perl : File::Spec->rel2abs($perl);
- # Try 2, Check $^X for a valid relative path
- my $abs_perl = File::Spec->rel2abs($perl);
- push @potential_perls, $abs_perl;
-
- # Try 3, Last ditch effort: These two option use hackery to try to locate
+ # Try 2, Last ditch effort: These two option use hackery to try to locate
# a suitable perl. The hack varies depending on whether we are running
# from an installed perl or an uninstalled perl in the perl source dist.
if ($ENV{PERL_CORE}) {
@@ -51,7 +47,7 @@ sub _discover_perl_interpreter {
}
else {
- # Try 3.B, First look in $Config{perlpath}, then search the user's
+ # Try 2.B, First look in $Config{perlpath}, then search the user's
# PATH. We do not want to do either if we are running from an
# uninstalled perl in a perl source tree.

0 comments on commit d447276

Please sign in to comment.