You don't use a filename with use(), and it's not just flat namespaces that have the problem.
The problem is a combination of the inner workings of %INC and @INC. If @INC has a relative path in it, and it finds the requested module in the current working directory, it loads it. That could be a name like ./Module.pm or nested path like ./Foo/Bar/Baz/Module.pm. Later in the script (or system like mod_perl), if we try the same thing from a different directory where there is the same relative path but to a different module, %INC thinks it already loaded it. It's the path that matters, not the module file name. %INC just stores the path name. A relative path can represent multiple files, but an absolute path points to one file.
This doesn't bite people with regular scripts because they don't have to worry about persistence. This bites people under mod_perl because a lot of scripts share %INC, and somebody may have already loaded a module. It only bites them if they use relative paths in @INC. If they don't do that, they should get what they expect. Modules like FindBin can help a script figure out where it is, although I prefer to simply install modules in known locations.
Still, this doesn't have anything to do with the layout of a distribution or what its files should be named, at least no more than it does in any other situation.
In reply to Re^2: Separate files for CPAN dist
by brian_d_foy
in thread Separate files for CPAN dist
by jacques
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |