How do I chdir in an exec?

David E. Wheeler david at kineticode.com
Mon Mar 9 00:56:56 GMT 2009


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?

Best,

David


More information about the tapx-dev mailing list