[Bps-public-commit] r16866 - Prophet/trunk/lib/Prophet

ruz at bestpractical.com ruz at bestpractical.com
Mon Nov 17 10:51:04 EST 2008


Author: ruz
Date: Mon Nov 17 10:50:57 2008
New Revision: 16866

Modified:
   Prophet/trunk/lib/Prophet/Test.pm

Log:
* allow to run run_script function in tests like t/foo/bar.t

Modified: Prophet/trunk/lib/Prophet/Test.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test.pm	(original)
+++ Prophet/trunk/lib/Prophet/Test.pm	Mon Nov 17 10:50:57 2008
@@ -166,8 +166,13 @@
 our $RUNCNT;
 
 sub _get_perl_cmd {
-    my $base_dir = Path::Class::File->new($0)->dir->parent->subdir('bin');
+    my ($tmp, $i) = (Path::Class::File->new($0)->dir, 0);
+    while ( !$tmp->subdir('bin')->stat && $i++ < 10 ) {
+        $tmp = $tmp->parent;
+    }
+    die "couldn't find bin dir" unless $tmp->subdir('bin')->stat;
 
+    my $base_dir = $tmp->subdir('bin');
     my $script = shift;
     my @cmd = ( $^X, ( map {"-I$_"} @INC ) );
     push @cmd, '-MDevel::Cover' if $INC{'Devel/Cover.pm'};



More information about the Bps-public-commit mailing list