Skip Menu |

This queue is for tickets about the Config-General CPAN distribution.

Report information
The Basics
Id: 3682
Status: resolved
Priority: 0/
Queue: Config-General

People
Owner: tlinden [...] cpan.org
Requestors: johnday [...] wordsnimages.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.21
Fixed in: (no value)



Subject: Install errors on Windows
I particularly liked the module when I read the CPAN docs, but noted that ActiveState showed it failing compilation. But I decided to try it. Here is the result - one test returns not OK, test 19 failed. K:\Perl\site\Config-General-2.21\Config-General-2.21>perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Config::General K:\Perl\site\Config-General-2.21\Config-General-2.21>nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cp General.pm blib\lib\Config\General.pm cp General/Interpolated.pm blib\lib\Config\General/Interpolated.pm cp General/Extended.pm blib\lib\Config\General/Extended.pm K:\Perl\site\Config-General-2.21\Config-General-2.21>nmake test Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. K:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t\run.t t\run.... .. ok # loading Config::General t\run....ok 1/19 ... ok # Nested block test t\run....ok 2/19 ... ok # Array content test t\run....ok 3/19 ... ok # Here-document test t\run....ok 4/19 ... ok # Multiline option test t\run....ok 5/19 ... ok # Comment test t\run....ok 6/19 ... ok # Case insensitive block test t\run....ok 7/198 ... not ok ... ok # Creating a new object from config file t\run....ok 8/19 ... ok # Creating a new object using the hash parameter way t\run....ok 9/19 .. ok # Creating a new object from a block t\run....ok 10/19 .. ok # Creating a new object from a sub block t\run....ok 11/19 .. ok # Getting values from the object t\run....ok 12/19 .. ok # Using keys() and values() t\run....ok 13/19 .. ok # Using AUTOLOAD methods t\run....ok 14/19 .. ok # Testing variable interpolation t\run....ok 15/19 .. ok # Testing value pre-setting using a hash t\run....ok 16/19 .. ok # Testing value pre-setting using a string t\run....ok 17/19 .. ok # Testing various otion/value assignment notations t\run....FAILED test 19 Failed 1/19 tests, 94.74% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t\run.t 19 1 5.26% 19 Failed 1/1 test scripts, 0.00% okay. 1/19 subtests failed, 94.74% okay. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0xff' Stop. K:\Perl\site\Config-General-2.21\Config-General-2.21>
Same issue with Config-General-2.23
This is actually not a bug in Config::General but in ActiveState's perl. In fact, test 8 fails (not 19!). This test reads a config from file cfg.8, writes it out to cfg.out, reads it back in (using a new object) and compares the results. And this comparision fails. The problem is, that ActiveState's perl adds an additional \r to every newline Config::General writes. Example: the module writes a scalar config option to the disk (in _write_scalar()), it adds an '\n' to the end of the line. But perl writes '\r\n' to the file then. Later, when test number 8 compares the written config with the original one it encounters one additional character per line: '\r'. IMHO, ActiveState should asap. fix this bug. If I write print '\n' perl should just print '\n' and no more. And I will not fix this in Config::General. I am using chomp() to remove trailing newlines when I read lines. Due to the documentation of chomp() this function removes $/ (input record separator) from the end of a string. Under windows this must contain \r too, but ActiveState seems to set it to \n only, therefore the \r remains in the string, and that's why test 8 fails. Please forward this bug(better: those *two* bugs) to ActiveState, thanks. - Tom PS: I'll keep the ticket open for a while to tracking this issue..
Filed new bug report at http://bugs.activestate.com about the chomp() problem. Bug ID: #27808. Ticket on wait.
Show quoted text
> IMHO, ActiveState should asap. fix this bug. If I write print '\n' > perl > should just print '\n' and no more.
That's not how it works. To get that behaviour you need to either - binmode the filehandle before you print - use the open pragma to set default discipline Example (your modules test suite) perl -Mblib -Mopen=IN,:raw,OUT,:raw t/run.t Using C:/perl/.cpanplus/5.6.1/build/Config-General-2.26/blib 1..19 ok .. ok # loading Config::General ok ... ok # Nested block test ok ... ok # Array content test ok ... ok # Here-document test ok ... ok # Multiline option test ok ... ok # Comment test ok ... ok # Case insensitive block test ok ... ok # Writing Config Hash to disk and compare with original ok ... ok # Creating a new object from config file ok ... ok # Creating a new object using the hash parameter way ok .. ok # Creating a new object from a block ok .. ok # Creating a new object from a sub block ok .. ok # Getting values from the object ok .. ok # Using keys() and values() ok .. ok # Using AUTOLOAD methods ok .. ok # Testing variable interpolation ok .. ok # Testing value pre-setting using a hash ok .. ok # Testing value pre-setting using a string ok .. ok # Testing various otion/value assignment notations This is well documented in perlport See "Newlines" in the perlport manpage. Show quoted text
> > And I will not fix this in Config::General. I am using chomp() to
all it takes is a binmode in the right spot
[guest - Mon May 24 15:11:39 2004]: Show quoted text
> > > > And I will not fix this in Config::General. I am using chomp() to
> > all it takes is a binmode in the right spot
For 2.26. Right spot is change blank line 838 of General.pm to "binmode $fh;"
Show quoted text
> Right spot is change blank line 838 of General.pm to "binmode $fh;"
sorry for the late reply. the manpage of perlport tells about newline: Perl uses "\n" to represent the "logical" newline, where what is logical may depend on the platform in use. In MacPerl, "\n" always means "\015". In DOSish perls, "\n" usually means "\012", but when accessing a file in "text" mode, STDIO translates it to (or from) "\015\012", depending on whether you're reading or writing. Unix does the same thing on ttys in canonical mode. "\015\012" is commonly referred to as CRLF. That means, if I say "\n", on whatever platform, it MUST work, because I don't have to care about what kind of newline it is using, because \n is in fact just a virtual representation. In Addition, I removed the binmode() call in version 2.27, because it is not portable (it breaks portability), especially I don't access binary files. Oh, and I tested it with a native compiled perl (not activestate's perl) and there it works perfectly well.