Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newer versions of MCE fail to provide ARRAYREFs sometimes #135

Closed
teodesian opened this issue May 16, 2017 · 6 comments
Closed

Newer versions of MCE fail to provide ARRAYREFs sometimes #135

teodesian opened this issue May 16, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@teodesian
Copy link
Owner

single elem arrays appear to be de-arrayed. Easy enough

@teodesian teodesian added the bug label May 16, 2017
@teodesian teodesian added this to the 0.040 milestone May 16, 2017
@teodesian teodesian self-assigned this May 16, 2017
@teodesian
Copy link
Owner Author

this is looking pretty scary actually. Seems it's losing data along the way!

@teodesian
Copy link
Owner Author

@teodesian
Copy link
Owner Author

According to Mario, I can do more than mitigate this behavior by simply passing an arrayref to mce_loop. As such, this issue is reopened.

@teodesian teodesian reopened this Jun 5, 2017
@teodesian teodesian modified the milestones: 0.041, 0.040 Jun 5, 2017
@marioroy
Copy link

marioroy commented Jun 5, 2017

Hi @teodesian.

Folks have wanted the ability for MCE to process a hash as input data. That feature was added recently. But, that made knowing the type to process problematic for an array containing a single element which happens to be a hash ref. MCE will think to process a hash due to being a single element. To ensure MCE is choosing the right type, the solution is to give mce_loop the array ref ( $runs ) instead of ( @$runs ). This is the recommendation when input data contains nested data.

Regards,
Mario

@teodesian
Copy link
Owner Author

@marioroy it looks like accepting arrayrefs has been a feature of MCE::Loop::run() for some time now, at least as far as github knows:

https://github.com/marioroy/mce-perl/blob/b8b5ac01611dd437fe3912f95378c7621440b995/lib/MCE/Loop.pm#L239

This shouldn't be a problem for the deploy environments I care about, so hopefully I won't have to worry about specifying a minimum version. That is, supposing that my interpretation of the above code is correct.

teodesian added a commit that referenced this issue Jun 7, 2017
@marioroy
Copy link

marioroy commented Jun 7, 2017

@teodesian your interpretation is correct. MCE::Loop supported arrayrefs since introduction or 1.500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants