I have an application I run under mod_perl where doing the
configuration involves some fairly heavy lifting. I reduce
the configuration into a hashref, and then use the Storable
module to stick the data in a file. I find the lock_nstore
and lock_retrieve functions you can import from Storable a
very hady and compact way to do this.
When I load the Apache module, I retrieve the file and thaw
it. Thereafter I track the modification time to see if I
need to load a new copy of the data structure.
Lately I've taken to just writing short perl scripts
like
use Storable qw/lock_nstore/;
my $cfg = {
## configuration data here
};
lock_nstore($cfg => '/some/file/name/here');
And doing a quick edit of the data structure and rerunning them to change the server configuration.
Of course, avoid doing this for truly massive (> 10,000
items) data structures, as your server process memory consumption will just eat you alive.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.