Search code examples
perlmoduleperl-modulestorable

What is the Storable module used for?


I am having a hard time understanding what Storable does.

I know that it "stores" a variable into your disk, but why would I need to do that? What would I use this module for, and how would I do it?


Solution

  • Reasons that spring to mind:

    • Persist memory across script calls
    • Sharing variables across different processes (sometimes it isn't possible to pipe stuff)

    Of course, that's not all that Storable does. It also:

    • Makes it possible to create deep clones of data structures
    • Serializes the data structure stored, which implies a smaller file footprint than output from Data::Dump
    • Is optimized for speed (so it's faster to retrieve than to require a file containing Data::Dump output