# from David Golden
# on Friday 28 August 2009 09:09:

>Could have DistGen create a tmp dir that doesn't set CLEANUP and
>records initial directory.

It already records the initial directory from chdir_in().

>Then DistGen's DESTROY could chdir to the 
>original and remove the temp.  That keeps it all in DistGen rather
>than MBTest.

You should be able to call DistGen's remove() from DESTROY.

There are some places (like manifypods.t) where the $tmp is reused in 
later calls to DistGen->new(), but each DistGen object should simply 
have its own temp dir.

It looks like we can nuke this cwd default

    $options{dir}  ||= Cwd::cwd();

And just:

    $options{dir} ||= $package->tmpdir;

But don't rmtree the dir if you didn't create it! -- maybe dir should 
simply not be an option because we're never using it.

>It's not that MBTest's chdir in END is a bad idea,  but
>I don't like relying on it for DistGen destruction.

Yeah.  It looks like there are very few places where tmpdir is being 
used alone (write_default_maniskip.t - but I think even that one should 
just be done with DistGen.)

So, actually I think we can remove the MBTest->tmpdir and that END block 
entirely once all of the tests stop doing DistGen->new(dir => $tmp).  
Further, the # cleanup stuff doing $dist->remove at the end can go away 
too.

--Eric
-- 
[...proprietary software is better than gpl because...] "There is value
in having somebody you can write checks to, and they fix bugs."
--Mike McNamara (president of a commercial software company)
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to