Clear questions and runnable code
get the best and fastest answer
The Case for Sensitivity to Case-Insensitivity in Module Namesby QwertyD (Pilgrim)
|on Apr 15, 2004 at 17:47 UTC||Need Help??|
It is also widely known that modules are stored in a directory structure that mirrors their names, such that Beverage::Carbonated::CO2 is stored in lib/Beverage/Carbonated/CO2.pm.
It is less widely known that some file systems are case-insensitive, notably those used by the MacOS (including MacOS X) and some configurations of Windows.
The result of these three facts is that Beverage::Carbonated::CO2 and Beverage::Carbonated::Co2 are different modules, with different packages, but cannot be easily installed at the same time on some OSes.
"So what?" you ask. "Surely there aren't any CPAN modules whose names differ only in capitalization!"
Unfortunately, there are.
As of 12 April 2004, 44 sets of CPAN modules had names that differed only in capitalization. The full list appears at the end of my post, along with the program that generated it.
I first realized this problem when I was checking to see if I had the latest version of Pod::HTML. Um, I mean, Pod::Html. The latter is included with the core Perl distribution, the former is part of the PodSimplify distribution. The problem is, the two are different modules, with different interfaces. If I had actually installed Pod::HTML, it would have overwritten Pod::Html, meaning that pod2html and any script that used Pod::Html would no longer work, and I would have a heck of a time figuring out why.
The lesson is, make sure your module's name differs from other modules' names in more than just capitalization, and be careful about capitalization when you're installing a module on a case-insensitive file system.
Do not have two files or directories of the same name with different case, like test.pl and Test.pl, as many platforms have case-insensitive (or at least case-forgiving) filenames.It might be a good idea to add something about module names after that.
Please note that this is not a flame against anyone who has written a module whose name differs from another module's by only case. It's difficult to take into account the peculiarities of other platforms when you're developing, especially when you can't test on those platforms.
(And yes, I am aware that there can be several different lib directories in which modules can be installed, but as long as one of them is always used for module installation, the problem with overwriting modules still applies.)
The list of modules and the program used to generate the list appear below:44 sets of duplicates:
Once it's Turing complete, everything else is just syntactic sugar.