Subject: | Hash Key Sorting |
Date: | Wed, 28 May 2014 14:16:10 +1200 |
To: | <bug-Data-Printer [...] rt.cpan.org> |
From: | "Tai Paul" <tai [...] pplus.co.nz> |
Hello,
Please find below a script that produces correct or mangled hash sort
results depending on the operating system or version number of
Data::Printer.
Unfortunately the results are inconclusive as to whether the problem is in
Data::Printer 0.35 or Fedora. As I have no other linux versions and lack
the relevant skills I am sending this bug report to you.
Thank you for an otherwise excellent module.
Tai Paul
Results Summary Table
OS
Perl version
Data Printer Version
Result
Fedora 17
perl v5.14.4
0.35
Mangled
Fedora 20
perl 5.18.2
0.35
Mangled
Windows 7
perl v5.14.2
0.30
Correct
Windows 8
Perl v5.16.2
0.30
Correct
Script
#!/usr/bin/perl -w
use Data::Printer output => 'stdout' ;
use POSIX qw(setlocale LC_NUMERIC);
print q{LC_NUMERIC = [} . setlocale(LC_NUMERIC) . "]\n";
print q{Data::Printer::$VERSION = [} . $Data::Printer::VERSION . "]\n";
print q{Operating System [} . $^O . "]\n";
print q{Perl Version [} . $^V . "]\n";
my $hash = {
MOD_BASE_COLOR => "Line 7 after sort",
MOD_BAS_TASTE => "Line 6 after sort",
MOD_BAS_FLAVOR => "Line 5 after sort",
MOD_APPLICATION_NAME => "Line 4 after sort",
MOD_APP_NAME => "Line 3 after sort",
MOD_APP_LONG_NAME => "Line 2 after sort",
MOD_APP_DOMAIN => "Line 1 after sort",
};
p $hash;
Output from Windows 7;
LC_NUMERIC = [C]
Data::Printer::$VERSION = [0.3]
Operating System [MSWin32]
Perl Version [v5.14.2]
\ {
MOD_APP_DOMAIN "Line 1 after sort",
MOD_APP_LONG_NAME "Line 2 after sort",
MOD_APP_NAME "Line 3 after sort",
MOD_APPLICATION_NAME "Line 4 after sort",
MOD_BAS_FLAVOR "Line 5 after sort",
MOD_BAS_TASTE "Line 6 after sort",
MOD_BASE_COLOR "Line 7 after sort"
}
Output from Windows 8
LC_NUMERIC = [C]
Data::Printer::$VERSION = [0.3]
Operating System [MSWin32]
Perl Version [v5.16.3]
\ {
MOD_APP_DOMAIN "Line 1 after sort",
MOD_APP_LONG_NAME "Line 2 after sort",
MOD_APP_NAME "Line 3 after sort",
MOD_APPLICATION_NAME "Line 4 after sort",
MOD_BAS_FLAVOR "Line 5 after sort",
MOD_BAS_TASTE "Line 6 after sort",
MOD_BASE_COLOR "Line 7 after sort"
}
Output from Fedora 17
LC_NUMERIC = [C]
Data::Printer::$VERSION = [0.35]
Operating System [linux]
Perl Version [v5.14.4]
\ {
MOD_APP_DOMAIN "Line 1 after sort",
MOD_APPLICATION_NAME "Line 4 after sort",
MOD_APP_LONG_NAME "Line 2 after sort",
MOD_APP_NAME "Line 3 after sort",
MOD_BASE_COLOR "Line 7 after sort",
MOD_BAS_FLAVOR "Line 5 after sort",
MOD_BAS_TASTE "Line 6 after sort"
}
Output from Fedora 20
LC_NUMERIC = [C]
Data::Printer::$VERSION = [0.35]
Operating System [linux]
Perl Version [v5.18.2]
\ {
MOD_APP_DOMAIN "Line 1 after sort",
MOD_APPLICATION_NAME "Line 4 after sort",
MOD_APP_LONG_NAME "Line 2 after sort",
MOD_APP_NAME "Line 3 after sort",
MOD_BASE_COLOR "Line 7 after sort",
MOD_BAS_FLAVOR "Line 5 after sort",
MOD_BAS_TASTE "Line 6 after sort"
}
Message body is not shown because it is too large.