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.


In reply to Re^5: Do modules know the callers full path? by haukex
in thread Do modules know the callers full path? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.