Suppose that we run this very simple script on an OS with a case-sensitive
#!/usr/bin/perl -w use strict; use tk; # <-- there is a typo here my $mw = MainWindow->new(); MainLoop();We obtain the error message:
Can't locate tk.pm in @INC (@INC contains: ...etcso it's easy to fix the typo.
But if you run the same script in Windows, you obtain a bunch of error messages:
Subroutine Tk::optionAdd redefined at C:/perl/site/lib/Tk/Submethods.pm line 19. Subroutine Tk::optionGet redefined at C:/perl/site/lib/Tk/Submethods.pm line 19. Subroutine Tk::optionClear redefined at C:/perl/site/lib/Tk/Submethods.pm line 19. ... etc ... Subroutine Tk::configure redefined at C:/perl/site/lib/Tk.pm line 84. Subroutine Tk::cget redefined at C:/perl/site/lib/Tk.pm line 84. Undefined subroutine &main::MainLoop called at C:\tmp\ex.pl line 6....203 error messages unrelated with the typo! (Perl, internally, uses the file name 'tk' and not 'Tk' ...)
If we enable the strict file names checking with
#!/usr/bin/perl -w use strict; use Win32::StrictFileNames; use tk; # <-- there is a typo here my $mw = MainWindow->new(); MainLoop();we obtain the right error message:
Can't locate tk.pm in @INC ...
Because it is not always obvious to find where the path is incorrect
(especially if you are dislexic ;-), the 'warn' option exists.
For instance, if you run this script:
#!/usr/bin/perl -w use strict; use Win32::StrictFileNames 'warn'; use Tk; my $mw = MainWindow->new(); my $img=$mw->Photo(-file => "$Tk::library/demos/images/Mickey.gif"); $mw->Label(-image => $img)->pack; MainLoop();you will get a warning message:
Warning: case sensitive mismatch between File =C:\perl\site\lib\Tk\demos\images\Mickey.gif Long =C:\perl\site\lib\Tk\demos\images\mickey.gif Short=C:\perl\site\lib\Tk\demos\images\mickey.gif at C:/perl/site/lib/Tk/Image.pm line 21.
Fileis the file path to open,
Shortare the paths retained by the system, for comparison (the file path is compared to short and long paths, segment by segment).
This module is still experimental. Only use it for debug purpose (to test the paths in a cgi script, for instance).
Back to Top
Current version is 0.01
The module is in my
If you are using ActiveState's Perl distribution (Perl 5.6 or Perl 5.8), the easiest way to install this module is to use
ppm. Enter (or cut & paste) this command in a DOS console:
ppm install http://www.bribes.org/perl/ppm/Win32-StrictFileNames.ppd
The documentation, in html format, is at its usual location.
If you want, you can download the source file here:
or from the
To install the module, read the README file.
Back to Top