Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Need help with module problem specific to sun-solaris

by tachyon (Chancellor)
on Nov 08, 2002 at 20:17 UTC ( [id://211524]=note: print w/replies, xml ) Need Help??


in reply to Re: Need help with module problem specific to sun-solaris
in thread Need help with module problem specific to sun-solaris

Hmmm. As suspected the failures result from a sort order problem. The interesting thing is that they occur in a seemingly random manner (on most systems they are in one order and OK but on other systems they are broken.) CGI::Simple uses the same method of retaining passed param order as CGI. Params are parsed in the order they are received and the param keys are pushed into an array to remember the order. Specifically this happens

push @{$self->{'.parameters'}}, $param;

@.parameters is used to remeber the supplied order. In the test scripts the problem arises thusly:

# new() hash constructor print "Testing: new() hash constructor\n" if $debug; $q = new CGI::Simple( { 'foo'=>'1', 'bar'=>[2,3,4] } ); @av = $q->param; ok( (join' ',@av), 'foo bar' ); #68

This is the code for the first test that fails. Evidently on certain versions of perl/OS the bucket architecture changes so that when the hash ref is passed in some cases this code:

elsif ( (ref $init) =~ m/HASH/i ) { # initialize from param hash for my $param( keys %{$init} ) { $self->_add_param( $param, $init->{$param} ); } }

returns the keys in a different order. As a result they are pushed into @.parameters in a different order and returned in a different order. Adding a reverse sort at this point will fix the tests BUT as this is exactly the same method CGI uses break concurrence.

Rather than break this concurrence I will modify the test to reflect the two possible return cases. For all intents and purposes it is unlikey to make any real world difference.

Thanks very much for your time

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://211524]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found