http://qs321.pair.com?node_id=287563


in reply to Data files included in a package

Well, yes, a subdirectory of the library's own subdirectory looks OK to me. But maybe that's just me. Actually, any place where that package could reside in @INC is fine by me, but don't expect any help from perl to locate it from you. You'll have to emulate what perl does in require, scanning through @INC and seeing if the data files can be found. Or you could demand that the data files have a fixed relative position toward the location of the module file itself. You decide.

But don't take my word for it. Take a look at a well-established module from CPAN: XML::Parser. Just look at the character encoding files ("*.enc") that XML::Parser::Expat, the underlying parser engine, uses, and how it locates them in @INC — source of XML/Parser/Expat.pm, populating @Encoding_Path.

Addendum.

is there a method for determining the path to the package?
Take a look at %INC. If your module is Foo::Bar then it'll be under $INC{"Foo/Bar.pm"}, even on systems where the file path separator isn't a slash, like Windows (actually a backslash, though a slash works too) and the Apple Macintosh, where it is ":" (!).