Sébastien Aperghis-Tramoni wrote:
David Landgren wrote:
[...]
Does that sound sane? Does anyone have some pointers on how to deal with
the placement of datafiles on the local system with one module, and
having the other module know where to find them?
Or am I making this unnecessarily complicated? (I could just bundle
the data file with the distribution, but the size of the data file,
and the probability that the format is unlikely to change invites the
above approach).
Adam Kennedy wrote Data::Package after discovering fake modules that
actually are just data. Not sure if it solve your problem:
http://search.cpan.org/dist/Data-Package/
Data::Package is both a solution to that problem, and another I found
later...
It gives access to data at a certain CPAN namespace, without the
end-user having to know where that data comes from.
The idea being that while TODAY the data might be loaded statically from
a single hard-coded location, later you might want to make the data
updatable, and will have to move it from some read-only area to a
user-owned area that can be updated, or into a database, or so on.
And Data::Package also allows you to make those sorts of changes without
having to change any code for whatever is using the data.
For simple uses, you probably want File::ShareDir and the
Module::Install install_share command. Rather than putting data files
into the ordinary module location, this lets you put the files into the
auto directory defined for uses such as this.
Adam K