On Monday 02 December 2002 11:20, Tim Sweetman wrote: > > Mark Fowler wrote: > >> Doesn't December come round quickly? > >> > >> http://www.perladvent.org/2002/ > > Riiiiiiiiiiiight... > > so you use IO::AtomicFile, and ... at risk of being picky ... > 1. Its temporary filename doesn't incorporate anything random, or the > process ID. So should you happen to have two processes running > simultaneously (eg. wraparound cron syndrome), you could end up end with > interleaved interleaved content and not be very content content. Innit. > > 2. It's not fail-safe. If you don't explicitly do the "disaster > recovery" bit by using an eval block and the ->delete method (and > calling a fatal exception a disaster seems melodramatic), the default > behaviour is for IO::AtomicFile to quietly and silently put your > incomplete file into the place of the live one. > > Admittedly this makes life easier for people who want to drop > IO::AtomicFile in in place of IO::File, or Nick Hornby fans who don't > want to write "->commit", but that strikes me as the Wrong design decision. > > IMO, if you write a Perl module that does something nice and useful > transparently, it should bloody well do it properly, ie. not with > obscure edge cases that the user can't see and that you don't talk > about, and encouraging the user to do the right thing. Part of the point > of code reuse is that reused code can (and must) be built solidly. > > Cheers > > Tim
-- Robin Szemeti