Eric Roode on 16 Nov 2011 09:52:33 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Philadelphia-pm] Persistent data directory



On Wed, Nov 16, 2011 at 12:38 PM, Chris Nehren <c.nehren/phl@shadowcat.co.uk> wrote:
On Nov 16, 2011, at 12:32, Kurt Starsinic wrote:

> On Wed, Nov 16, 2011 at 12:26 PM, Eric Roode <sdn.phlpm@mailnull.com> wrote:
>> Hi all,
>>
>> I'm writing a new module, and it needs to store some data persistently
>> across invocations (basically a cache).  It is irrelevant whether this cache
>> is per-user or system-wide.
>>
>> Is there any sort of reasonably standard place to store such data?  This
>> will be run on Windows, for what it's worth, but it'd be good to know what
>> locations are standard practice on other platforms, too.  Is there any sort
>> of existing module that encapsulates this, so I won't have to think about it
>> (like how File::Temp provides for temporary data storage)?  I couldn't find
>> any.
> One perlish way to do this would be to save the data, encoded with
> Storable or Data::Dumper, to a file.
>
> - Kurt

Note that Storable (and to a lesser degree Data::Dumper) are serialization formats not readily readable by other tools/languages. Have you looked at the cache namespace on CPAN? Also consider CHI.

On CPAN, I find:

CHI::Driver::File, which requires you to specify a "root_dir".
Cache, which requires you to specify a "cache_root".
OOPS, which requires a DBI-accessible database server.
Tie::Persistent, which requires you to specify a file location.
Persistent::File, which requires you to specify a file location.

All of these require you to tell it where to store the data.  That's what I'm asking -- what's a good *place* to store persistent data?

I can certainly create some arbitrary directory somewhere and give the web server, or the application users, permission to write there. Is that the best practice?  An arbitrary directory, selected off the cuff?

-- Eric

_______________________________________________
Philadelphia-pm mailing list
Philadelphia-pm@pm.org
http://mail.pm.org/mailman/listinfo/philadelphia-pm