develooper Front page | perl.perl5.porters | Postings from April 2023

Case-insensitive file systems

Thread Next
From:
Ovid
Date:
April 14, 2023 17:10
Subject:
Case-insensitive file systems
Message ID:
CA+M4CHumWO6jR-41Y_jOx8crnRM0sAcFmMGAL=3=KoL81bMHWQ@mail.gmail.com
I blew an hour of a client's time trying to figure out why I was getting
redefined subroutine warnings. I eventually tracked them down to this:

# use `require` instead of `use` to avoid a
# circular load
require Client::Db;


I had *just* written that code and my tests for it passed. However, the
warnings were showing up elsewhere, so I was led on a wild goose chase.

It should have been:

require Client::DB;


Because the file system on Macs is case-insensitive, it didn't see
$INC{'Client/Db.pm'} and it cheerfully loaded Client/DB.pm and caused the
warning.

Is it possible to introduce some kind of lexically-scoped pragma to tell
Perl to to verify the case of the filename (and directories, too, of
course). This is not the first time I've been bitten by this and it would
be nice if it could be addressed.

Best,
Ovid

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About