Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to write perl modules that keep a dbm file (or other disk-based hash) of programs that use them. So I can find out "who uses this code?"
I have perl 5.10 and want to use the "best" dbm for the job.
So, what is the best dbm to use? gdbm?
I think I would store keys along the lines of "__PACKAGE__ $FindBin::Bin/$FindBin::$Script" -> localtime().
And I would remove keys with time values sufficiently old, say older than 2 years.
I need to support concurrency to a degree, as programs that use the same module may run simultaneously. It's okay if a record doesn't get written (I just want to have a way to inspect who is a likely consumer of the code in a module). It is *not* okay if the dbm gets corrupted or "breaks" the rest of the code. Maybe I wrap the whole thing in a module that uses caller() to keep track.... "use ModuleAuditor;" Is there an existing CPAN solution? Thanks Wise Monks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: best dbm for small dictionaries? write locking or concurrency needed
by Corion (Patriarch) on Oct 14, 2010 at 14:33 UTC | |
by Anonymous Monk on Oct 14, 2010 at 14:47 UTC | |
|
Re: best dbm for small dictionaries? write locking or concurrency needed
by roboticus (Chancellor) on Oct 14, 2010 at 15:34 UTC | |
by Anonymous Monk on Oct 14, 2010 at 15:58 UTC | |
|
Re: best dbm for small dictionaries? write locking or concurrency needed
by jethro (Monsignor) on Oct 14, 2010 at 16:58 UTC |