One of the weirdest portability problems I’ve ever encountered is dealing with platforms with case-insensitive filesystems. Files I expected to be there mysteriously weren’t. Files I didn’t expect to be there mysteriously were.

Case-sensitivity in programming languages confuses novices too, especially on insensitive platforms. The capitalization of certain words matters within the language where it doesn’t on the filesystem.

Usually that only leads to mysterious error messages. Though a novice may not know enough about the language to decipher the message yet, there’s no silent failure. Unfortunately, there’s a case in Perl where there are silent failures: pragmata.

A pragma is a module which has almost no interface. It exists merely to enable or to disable certain behavior. Think of strict or warnings.

When you use a module (use strict;), Perl takes the bareword name and translates that into a file path, using @INC as a list of directories to search for that file. If Perl loads and compiles that module, it attempts to call the import() method defined in the module so named. (There’s a special trick inside Perl to avoid any weird failures if that method does not exist.)

There is absolutely no requirement that code declared inside a module has to correspond to the name of the file; there’s no mapping between file names and namespaces in Perl. Here’s the problem with case-insensitive file systems and Perl pragmata.

On a system with a case-insensitive filesystem, you can say use Strict; and Perl will happily load strict.pm for you. That part’s fine. The second part isn’t–Perl will call Strict->import();, which probably does not exist. strict.pm defines strict::import() instead, which is what you want, but Perl won’t call that.

Because the strict pragma only warns when active, you may assume that your code is strict-safe, when in reality there are no warnings because you didn’t enable warnings.

There are various possibilities to fix this, but it’s a thorny problem. See The Strict Trap on the Perl 5 Porters mailing list for more information.