Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Sub attributes

by lodin (Hermit)
on Jun 10, 2009 at 20:33 UTC ( [id://770447]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Sub attributes
in thread Sub attributes

So only built-in attributes are recognized globally?

Correct. And that is how it should be. You don't want global attributes any more than you want global subroutines. I'm not saying that I like the current implementation, but at least its good that the attributes are somewhat scoped.

Since the handlers (MODIFY_CODE_ATTRIBUTES etc) are inherited one can add them to UNIVERSAL and achieve global attributes. Attribute::Handlers for instance uses this trick. This however makes it very dangerous to use attributes in modules, since attributes defined in different modules may clash. See also my previous meditation on the problems with attributes (it also links to other nodes about attributes).

lodin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://770447]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-20 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found