Subject: | BuiltinFunctions::ProhibitVoidMap is confusable about context, apparently. |
This code passes:
my $hashref = { map { $_ => 1 } $source->_get_files_array() };
$self->_set_files_hashref( $hashref );
[From File::List::Object 0.189]
This code - the logical equivalent - does not:
$self->_set_files_hashref( { map { $_ => 1 }
$source->_get_files_array() } );
(Explanation of the weird code is that $source->_get_files_array is
getting the keys of the internal hashref from the $source object, which
happen to be filenames. The "map" maps each filename to a two value
list, the filename and 1. The list returned from the map is made into a
hashref by the outer set of brackets, which is set into the internal
hashref of the destination object ($self) via $self->_set_files_hashref.
So the "map" is in list context, as far as I can tell, [because of the
hashref conversion] as opposed to the void context that the policy is
supposed to complain about.)