http://www.perlmonks.org?node_id=696604

hangon has asked for the wisdom of the Perl Monks concerning the following question:

A recent node reminded me of a problem I had a while back - how to include some sort of periodically changing data into a module. These are some possibilities I came up with, though I'm sure there are others:

  1. Incorporate the data directly into the module as a data structure, and just update the module when the data changes.
  2. Same, but incorporate it in a __DATA__ section of the module.
  3. Inherit from a separate data module.
  4. Use a separate config data file (text, yaml etc) for the module in @INC. Provide class method to update it.
  5. Provide methods to import and update the data in a config file local to the calling program.

My solution was #1 just for expedience (though it didn't feel quite right), however, the data was from the PNG specification, which shouldn't be expected to change often. Other data such as a list of PPM repositories may be more of a moving target. Especially for a CPAN module, it would seem useful to provide a method to update the data rather waiting for the module author or hacking the module yourself.

I was wondering what others have done, and what might be considered better ways of handling data for modules such as PPM::Repositories, where it's likely that the user would want or need to update the module's data on their own.