Open autarch opened 3 years ago
From drolsky@cpan.org (@autarch) on 2016-06-19 02:23:01 :
On Fri Jun 10 11:13:23 2016, random. wrote:
When I get this message:
Mandatory parameters 'x', 'y', 'z' missing in call to Foo::bar
The order of 'x', 'y', 'z' changes each time I run the code. It would be nice if it was sorted so it could be more easily checked in tests.
Using perl 5.22.2, an example:
use Params::Validate qw(:all); my @in = (); my %params = validate( @in, { x => { type => SCALAR }, y => { type => SCALAR }, z => { type => SCALAR }, });
Output on different runs:
Mandatory parameters 'y', 'x', 'z' missing in call to (unknown) at ./test.pl line 3.
Mandatory parameters 'z', 'x', 'y' missing in call to (unknown) at ./test.pl line 3.
Mandatory parameters 'x', 'y', 'z' missing in call to (unknown) at ./test.pl line 3.
This is because of the hash randomization changes in recentish Perl versions. Patches are welcome to sort the keys.
Migrated from rt.cpan.org #115241 (status was 'open')
Requestors:
From bitcard@siteaboutnothing.com on 2016-06-10 15:13:23 :
When I get this message:
The order of 'x', 'y', 'z' changes each time I run the code. It would be nice if it was sorted so it could be more easily checked in tests.
Using perl 5.22.2, an example:
use Params::Validate qw(:all); my @in = (); my %params = validate( @in, { x => { type => SCALAR }, y => { type => SCALAR }, z => { type => SCALAR }, });
Output on different runs:
Mandatory parameters 'y', 'x', 'z' missing in call to (unknown) at ./test.pl line 3.
Mandatory parameters 'z', 'x', 'y' missing in call to (unknown) at ./test.pl line 3.
Mandatory parameters 'x', 'y', 'z' missing in call to (unknown) at ./test.pl line 3.