in reply to Re^4: Do modules know the callers full path?
in thread Do modules know the callers full path?
In that case, I'd say the answer is: it depends. Is the data something that the module can download automatically, or does it need to be curated by hand? If it can be done automatically, one could consider caching it in a ~/.something directory. For system-wide installation, just as an example, Debian packages like tzdata store the zoneinfo in /usr/share.
While it might be possible, I'm not sure I would recommend storing the data alongside the module directly (i.e. in the same directory or even in its __DATA__ section) if one wants the data to be updatable independently of the module. The reason I think so is that the typical expectation of a Perl user / developer would be that the module directories are generally only affected by the installation of modules, and if the module were to change its own files that might lead to inconsistencies, e.g. if modules are re-installed.
With answers to the above questions, we could probably narrow down the suggestions even more.
Of course, if the data only changes once a year, I think it's also a reasonable idea to include the data in the module and release a new version of the module when the data changes.
Another point: I don't see why such a module would need to know its callers path? "The info is embedded in the module DATA" sounds like the module wants to modify its own code, not the caller's? A module can use __FILE__ to get its own filename, and if the @INC directory it is located in is an absolute path, __FILE__ should be an absolute path as well.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Do modules know the callers full path?
by Anonymous Monk on Feb 17, 2023 at 15:48 UTC | |
by soonix (Chancellor) on Feb 18, 2023 at 16:03 UTC |