in reply to Can't require MCE::Map (Strawberry)?

Hello Anonymous Monk (consider registering an account ;),

Unfortunately not a MCE expert, just a big promoter, but generally speaking use X is transalted with require X; import X LIST eventually inside BEGIN to mimicry exatly use

Consider, in StrawberryPerl:

C>perl -we "require MCE::Map; MCE::Map-> init(user_begin => sub {},use +r_end => sub {}); my @a = MCE::Map->run( sub { $_ }, [ 0 .. 9 ]);" # CTRL-C Terminating on signal SIGINT(2) MCE::shutdown: method is not allowed while running at -e line 0. END failed--call queue aborted, <__ANONIO__> line 80992. # LOOK HERE # C>perl -we "require MCE::Map; import MCE::Map; MCE::Map-> init(user_be +gin => sub {},user_end => sub {}); my @a = MCE::Map->run( sub { $_ }, + [ 0 .. 9 ]);" C>

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Can't require MCE::Map (Strawberry)?
by Anonymous Monk on Mar 07, 2025 at 10:29 UTC

    Yeah, thanks. Apparently, MCE::Map::import pre-assigns 'auto' to the CHUNK_SIZE property of a global, and if it's not assigned, then because of line 235, just before 'run', the chunk size is returned/gets undefined (why?) and somehow silently treated as zero (just guessing, didn't debug further), hence infinite loop. I'm now inclined to using the MCE proper anyway, but I think the situation is worth for Mario to have a look at.

      Have you considered filing an actual bug report? Or tagging Mario on this, which will now generate a notification for him?