in reply to Writing to a file atomically without renaming
Hi,
You can use the Tie::File module, and move accross the file like a array, before writing you get the number of the last index of the array, then add data to the file, and then if it fails because of exception, you remove from the saved point towards.
If it's binary data you should use seek for moving, etc...
Could be a solution for what you want, if I understand well your problem.
On the other hand, must it be stored in the filesystem, because, depending on your needs, on RDBMS with transactions... you don't get this "problem".
Regards,
|fire| at irc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing to a file atomically without renaming
by nomis80 (Sexton) on Jun 30, 2005 at 19:45 UTC | |
by waswas-fng (Curate) on Jun 30, 2005 at 20:02 UTC |