in reply to Maintaining state in modules

You got a lot of replies about DBM and ways to actually do the saving. I have a comment on the file part. For portability, names beginning with a dot may be not allowed on a file system; and the "current directory" is a shaky concept.

I'd make the location and/or filename more explicit to the module user, and the filename at least in one constant somewhere so it can be changed trivially if needed.

In fact, isolating the save/restore logic is a good idea in general, so the whole thing could be replaced without affecting the rest of the module.