[Rt-commit] r11864 - rt/branches/3.8-TESTING/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Wed Apr 23 21:33:55 EDT 2008


Author: ruz
Date: Wed Apr 23 21:33:54 2008
New Revision: 11864

Modified:
   rt/branches/3.8-TESTING/lib/RT/Test.pm

Log:
* add find_executable method

Modified: rt/branches/3.8-TESTING/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Test.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Test.pm	Wed Apr 23 21:33:54 2008
@@ -529,6 +529,19 @@
     return $content;
 }
 
+sub find_executable {
+    my $self = shift;
+    my $name = shift;
+
+    require File::Spec;
+    foreach my $dir ( split /:/, $ENV{'PATH'} ) {
+        my $fpath = File::Spec->catpath( (File::Spec->splitpath( $dir, 'no file' ))[0..1], $name );
+        next unless -e $fpath && -r _ && -x _;
+        return $fpath;
+    }
+    return undef;
+}
+
 sub import_gnupg_key {
     my $self = shift;
     my $key = shift;


More information about the Rt-commit mailing list