Re: Prototype Attributes
[email protected] (Tomas Doran)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
On 17 Dec 2008, at 08:07, Christopher Brown wrote: <snip> > > _1_ > The naive way is using normal attributes in standard roles. This > is simple > and straightforward. But implementing attributes this way, limits > one to > hardcoded attribute names and definitions. For example, if a role > defines > an attribute as 'rw', you could not easily specify it as 'ro' and > not before > it was already installed. The limitations of this approach is clear. I'm using this technique in a few places, and I do some overriding using the has '+attrname' syntax. It works well enough for my current use-case, but as you note has several disadvantages, and I can see a need for something more flexible. > _3_ > Another method would be to rewrite/overload/intercept the has > subroutine. I > haven't thought about the entire ramifications or complications > here. But > this is likely the best way to handle this. I'm not sure that I'm in favour of the syntax that you propose, however I wouldn't have a definite opinion until I could play with something.. > I would appreciate your thoughts, I'd certainly be prepared to spend some time playing with and giving you feedback on a MooseX module which implemented a prototype of the feature. Cheers t0m