[Edinburgh-pm] Question about using attributes

Robert Rothenberg robrwo at gmail.com
Tue Jun 21 14:01:24 PDT 2011


I am having a strange problem with Attribute::Handlers that looks like
some kind of bug:

  package MyPackage;

  use Attribute::Handlers;

  sub UNIVERSAL::foo :ATTR(CODE) {
    ...
  }

Basically, the "foo" function is called every time the compiler comes
across a function of the form

  sub bar:foo {
   ...
  }

it is supposed to call the "foo" handler. When something in package
main (i.e. a plain script) uses it, "foo" is indeed called.

But when it's called from a separate package in a separate file, "foo"
is not called, although the compiler does accept the ":foo" attribute.

Has anyone else run across this problem?


More information about the Edinburgh-pm mailing list