Strange things are occurring at compile time

David Cantrell david at
Wed Feb 29 17:00:59 GMT 2012

I've got some strange things going on in my code, and it's DOING MY 'EAD

In a parent class I have:

    my ($package, $subref, @attrs) = @_;
    use Data::Dumper;local $Data::Dumper::Indent=1;
    warn("storing attribs for $subref: ".join(", ", @attrs)."\n");
    $attrs{ refaddr $subref } = \@attrs;

and then in my class:

  my $wibble = sub :Something :AnotherThing {
    ... long subroutine body ...
  warn("defined $wibble\n");

As it compiles, it wibbles about storing the attribs, with a stringified
coderef.  Then at runtime it warn()s that it has defined something *with
a different coderef*:

  storing attribs for CODE(0x55f5528): Something, AnotherThing
  defined CODE(0x54245c8)

but if I comment out the subroutine body I get the same code-ref twice.

Am I going mad here?  I've already checked the obvious things - yes, my
code compiles *and runs* properly without any of this attribute nonsense
so there's no missing braces or anything; there are no eval { blocks }
or 'use's in the subroutine I'm defining that might Dick About With
Things at compile-time.

My apologies for the off-topic post.  Let me rehabilitate myself by
offering FREE BOOZE at tomorrow's social to anyone who can help me.

David Cantrell | top google result for "topless karaoke murders"

You don't need to spam good porn

More information about the mailing list