Subject: | File-LocalizeNewlines 1.08 Not Identifying localized files |
Date: | Fri, 23 May 2008 13:23:29 -0400 |
To: | bug-File-LocalizeNewlines [...] rt.cpan.org |
From: | "Matt Conte" <contem [...] gmail.com> |
I started using this module the other day and made a test case to see if the
module was working correctly. Unfortunately, the simple test case I made
was not supported by the module. The module does localize files correctly,
but testing the files with the localized method returns incorrect results.
The test:
I created 3 text files using NotePad++ 4.9.2 for Windows XP.
1) Unix.txt:
Unix<LF>
Unix<LF>
Unix<LF>
2) Win.txt:
Win<CR><LF>
Win<CR><LF>
Win<CR><LF>
3) Mac.txt:
Mac<CR>
Mac<CR>
Mac<CR>
Then I created this test script: test.pl
<code>
#!/usr/local/bin/perl
use File::LocalizeNewlines;
FLOOP: foreach my $file (@ARGV) {
open(FILE, "+< $file") or do {print "Can not open the $file input file
for read/write: $!\n"; next FLOOP;};
print "$file\n";
print "Localized: ",File::LocalizeNewlines->localized($file),"\n";
File::LocalizeNewlines->localize(FILE);
close(FILE);
}
</code>
This script returned on my Windows XP machine:
C:\Test\Mac.txt
Localized:
C:\Test\Win.txt
Localized: 1
C:\Test\Unix.txt
Localized: 1
The New Files appear as:
1) Unix.txt:
Unix<CR><LF>
Unix<CR><LF>
Unix<CR><LF>
2) Win.txt:
Win<CR><LF>
Win<CR><LF>
Win<CR><LF>
3) Mac.txt:
Mac<CR><LF>
Mac<CR><LF>
Mac<CR><LF>
The module is telling me that there is an issue deciphering the Mac
formatted file, the Windows formatted file is localized (as it should be),
and the Unix formatted file is localized (which is incorrect). However, the
actual localization of the file is correct.
System Information:
OS: Windows XP SP2
Perl Distribution: ActiveState 5.10.0 Build 1003 for
MSWin32-x86-multi-thread
Module: File-LocalizeNewlines 1.08