May 22, 2015
🐪 🧑🏽💻
I use temporary files pretty often. There are a bunch of ways to do this, and
File::Temp is probably the most popular. It’s pretty good, but also pretty
complicated. A big part of this complication is that it’s meant to keep your
filename around until you’re done with it, and to let you pick its name and
location. Often, though, I don’t need these features. I just need a place to
stream a whole bunch of data that I’ll seek around in later, or maybe just
stream back out. In other words, instead of holding a whole lot of data in
memory, put it in a file.