Subject: | Blanked parameters / Bizarre copy of ARRAY |
I am getting an issue when using MooseX::Params::Validate::validated_list.
So, we have a bit of code which goes like this
sub _apply_action_to_sale_flags_by_pid {
my ($self, $sale_flags_by_pid, $list_action) = validated_list(
\@_,
sale_flags_by_pid => { isa => Map[ProductId, Bool] },
list_action => { isa => Dict[
action => ListAction, # create or delete
type => Str,
pids => ArrayRef,
slurpy HashRef # Allow any other keys
# (Don't put anything after "slurpy")
]
},
);
...
where ProductId and ListAction are types declared using MooseX::Types.
Under certain circumstances, we can pass in both named parameters, verified as defined values, but the results in $sale_flags_by_pid and $list_action both end up as undef.
Under other circumstances, it has also come back with the “Bizarre copy of ARRAY” error.
Diagnostics reveal that when it is failing, 'validated_list' is returning a 3-element list where the first element looks like a ref to the invocant, and the other two elements are undef.
Now, it only seems to fail when perl has done a "lot" of work previously to this call.
When perl hasn't done much work, it works fine.
If I arrange things to make it fail (i.e. making perl do "a lot" of work), then run the program under PARAMS_VALIDATE_IMPLEMENTATION=PP, then that makes things work again.
The context in which it fails is rather involved, and it's not convenient for me to try to construct a minimal failure case.
But I thought it might be an idea to at least raise an issue so that if anyone else sees a similar issue we can get statistics and perhaps that can guide where best to expend diagnostic resource.
For now I may need to force the pure perl implementation.