Bug? Feature? I report, you decide (and yes, I hate Fox News).
It didn't take me long to fix because I've seen this before, but I had to jog my memory. I wonder if PPI would catch this?
sub find_mapper_class_for { my ($self, $pip_obj) = @_; my %domain_to_mapper_map_for = map { "Pips3::Domain::$_" => $_ } qw( Brand Episode OnDemand Promotion Schedule Segment SegmentEvent Series Version ); my $mapper = $domain_to_mapper_map_for{ ref $pip_obj } or X::Internal->throw( details => "Unknown mapper (" . Dumper($pip_obj) . ")", stack_trace => longmess(), ); return "Pips3::Persister::Mapper::DBIC::$mapper"; }
I have been tripped up by this a couple of times now and it can be a devil to figure out if you're not familiar with it. Heuristic parsing ain't fun.
map { foo => 1; }
...;
map (foo => 1),...;
also fail, for different reasons. I think a habit of
map {; foo => 1 }
...;
might be safest...
No, PPI has had a heck of a time just matching Perl's behavior in this. For a while we leaned way to far towards blocks and missed a lot of hashrefs. Adam made it a lot better now, but it's still far from perfect.