We have a process that calls an API that returns JSON. The data doesn't change frequently and the JSON payload is reasonably large and has to be accessed in chunks.
Because we are calling it more frequently, I thought it would be a good idea to cache it to a text file and use that if it under a few hours old.
The module I'm using is internal, so I have complete control over where I save the cached data.
But, over dinner, whilst tucking into roast pork and sprouts (one of my favourite vegetables), I pondered how to approach this if it was a module I intended to publish on CPAN. This module will never be published, but I can imagine plenty of reasons for CPAN modules to need to write files just for their own use.
Is there a standard way to handle this?
Can we be sure that the module will have write permissions on the directory where it resides?
Is there an environment variable common to all environments for a temporary directory that can be used for this sort of thing?
In reply to Where to save module data by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |