On Jan 17, 2010, at 6:31 PM, Geoffrey Leach wrote:
I'm dealing with an error report from cpantesters for Getopt::Auto. The problem arrises out of using Test::More::is_deeply to compare a hash with what's generated at run time: it comes out different.I've delt with this problem in my own testing, and have spent some timegetting it 'just right'. I suspect the problem arrises out of how Perl organizes the hash. The version with the problem is perl-5.6.2. Later versions pass. Given that I'm using an unsupported feature, things may well come unglued in the future. So, are there any suggestions? Test::Deep? 'use Perl 5.8.0'? Thanks.
On Darwin 10.5, I have duplicated the problem with a custom-compiled Perl 5.6.2.
http://matrix.cpantesters.org/?dist=Getopt_Auto+1.9.0 http://www.nntp.perl.org/group/perl.cpan.testers/2010/01/msg6653780.html http://www.nntp.perl.org/group/perl.cpan.testers/2010/01/msg6683196.htmlThe problem is caused by Getopt::Auto's use of each() to build @spec in sub _parse_pod.
Since the iteration order of each() is not guaranteed between versions of Perl
(and sometimes even between program runs; see `perldoc -f each`), you will either need to 1) pre-sort both the inputs to is_deeply, or 2) just apply the attached patch.The patch has been tested against 5.6.2 and 5.10. It changes sub _parse_pod to build @spec from within a for loop of sorted keys, and changes the order
of the expected arrays in 03-options_bare.t and 03-options_text.t . -- Hope this helps, Bruce Gray (Util of PerlMonks) Posting from the excellent Perl Oasis conference
Getopt_Auto_sorted_keys_fix.patch
Description: Binary data