[Bps-public-commit] plient branch, master, updated. f18285a2608ad9019849a3e93b256fd3b39ec978

? sunnavy sunnavy at bestpractical.com
Tue May 11 02:20:20 EDT 2010


The branch, master has been updated
       via  f18285a2608ad9019849a3e93b256fd3b39ec978 (commit)
      from  b5965d0f6390681d11bb6908883193a4c4e4b18b (commit)

Summary of changes:
 lib/Plient/Util.pm |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit f18285a2608ad9019849a3e93b256fd3b39ec978
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue May 11 10:17:40 2010 +0800

    tweak which

diff --git a/lib/Plient/Util.pm b/lib/Plient/Util.pm
index 691e732..c4fa7df 100644
--- a/lib/Plient/Util.pm
+++ b/lib/Plient/Util.pm
@@ -23,25 +23,25 @@ sub which {
     if ( !$path ) {
 
         # fallback to our way
+LINE:
         for my $dir ( path() ) {
             my $path = catfile( $dir, $name );
 
             # XXX  any other names need to try?
             my @try = grep { -x } ( $path, $path .= $bin_ext );
             for my $try (@try) {
-                return $path;
+                $path = $try;
+                last LINE;
             }
         }
     }
 
+    return unless $path;
     if ( $path =~ /\s/ && $path !~ /^$bin_quote/ ) {
         $path = $bin_quote . $path . $bin_quote;
     }
 
-    if ($path) {
-        return $cache{$path} = $path;
-    }
-    return;
+    return $cache{$name} = $path;
 }
 
 1;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list