# from David Golden # on Friday 28 August 2009 03:31: >Looking at MBTest, it has an END block to chdir so the END in my >example isn't really necessary. But it's a code smell to me to rely >on such action at a distance to do the right thing.
But remember it used to be that same END block which would both chdir and delete it before we switched to using File::Temp, which itself uses an END block to delete. If you can make File::Temp do the chdir, then great. It might be action at a distance, but that's part of the MBTest->tmpdir abstraction, so spreading some extra END blocks around the tests isn't going to help (it just increases the effort needed to change the abstraction.) I think distant action controlled by abstracted code is better than distant action controlled by distant code. Of course, maybe what we really need is for DistGen to be able to create the temp dir in the constructor, then call remove() from DESTROY. --Eric -- Turns out the optimal technique is to put it in reverse and gun it. --Steven Squyres (on challenges in interplanetary robot navigation) --------------------------------------------------- http://scratchcomputing.com ---------------------------------------------------