How do I chdir in an exec?

David Golden xdaveg at gmail.com
Mon Mar 9 01:10:46 GMT 2009


On Sun, Mar 8, 2009 at 4:21 PM, Michael G Schwern <schwern at pobox.com> 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.

Unfortunately, not portable.  See perlport and open.

-- David


More information about the tapx-dev mailing list