Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday July 18, 2008
07:42 AM

One Bug I Really Hate

[ #36950 ]

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(

    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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • And of course, the 'obvious' workarounds

      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.