| [reply] |
Take a look at IO::Zlib. I believe it'll do exactly what you want -- that is, tie a compressed file and treat it like an ordinary file handle (a la Tie::File). In your case, I wouldn't keep the large data record compressed AND use a compressed data file -- I don't see that it buys you anything. Just use IO::Zlib and compress the whole file.
--RT | [reply] |
Tie::File streams the file off disk without slurping, but so would using a simple while(<>). On the other hand, the zipped chunk of data may contain newlines, and as far as I can tell you are not accounting for that. You can go to the trouble of zipping the "database files", but the savings will likely be marginal, and hardly justify the trouble you have to go through.
I don't think it's a good strategy, really. Is there any specific reason not to use an actual database? Or, barring that, for whatever reason, maybe something like Archive::Zip?
Makeshifts last the longest.
| [reply] [d/l] |
I wanted to do something similar. The suggestion of IO::Zlib and Tie::File seemed like a nice idea, but IO::Zlib doesn't support seeking as required by Tie::File.
Thanks,
Arthur
| [reply] |