How do I chdir in an exec?
Michael G Schwern
schwern at pobox.com
Mon Mar 9 20:22:08 GMT 2009
David E. Wheeler wrote:
> On Mar 8, 2009, at 1:21 PM, Michael G Schwern wrote:
>
>> A simple solution to this problem would seem to be allowing exec (or
>> a new
>> option) to return a filehandle in place of a command to run.
>>
>> exec => sub {
>> ...derive $sub_module, $command and $file...
>>
>> chdir "ext/$sub_module";
>> open my $fh, "-|", $command, $file;
>> chdir "../..";
>>
>> return $fh;
>> }
>>
>> This gives the user complete control over the running of the test
>> without
>> having to bail out to a separate script.
>
> Seems like a reasonable solution. I like it.
>
> BTW, now that you're using a subref for exec, how do you feel about
> your proposal for .tapharnessrc files?
The same. It's a good idea. My reservations about allowing exec to be a
subref in the config file are general purpose ones based on the idea of
putting executable code into a config file. I don't really have a strong opinion.
I do still think it should look in $PWD and $HOME layering the one in $PWD on
top of $HOME. Andy's right that it might produce hard to diagnose
configurations, but I think the power is worth the possibility that the user
will hang their self. Otherwise it becomes only of use to a project and not
to the user running the test.
A simple diagnostic tool would be an option to dump out the config as TH sees
it noting where each option came from.
--
ROCKS FALL! EVERYONE DIES!
http://www.somethingpositive.net/sp05032002.shtml
More information about the tapx-dev
mailing list