in reply to Move files w/ commit-rollback mechanism?

How would I implement it? I'd download it from CPAN. File::Transaction and File::Transaction::Atomic await you, with full source code.
  • Comment on Re: Move files w/ commit-rollback mechanism?

Replies are listed 'Best First'.
Re^2: Move files w/ commit-rollback mechanism? (File::Transaction)
by tye (Sage) on Jun 12, 2003 at 02:45 UTC

    I'm assuming that since the original node said that "moving a bunch of files could take several minutes", that we aren't simply talking about "renaming" a bunch of files within a single file system. Given that, those modules don't support "moving" of files as part of the transaction. You could do all of the copying to temporaries first and then use addfile() to do the renaming step as a transaction, so it might save quite a bit of coding (I only took a quick look).

    They also don't support a rollback (from a persistant journal) if the process actually dies in the middle ("a disaster might strike").

    Or it might be fun to update the modules to support more forms of "moving" files and to add journaling.

                    - tye