Conceptually, this is an awesome idea. I was working on something similar, but am going to adopt Shawn's approach.
I would also advocate this or something similar migrate into the core of Moose. It abstracts away much of the complexity of trying to extend functionality of roles.
The documentation leaves some to be desired. But considering this is version 0.02. I have little worry that this will get better and more complete.
My only slight criticism -- is that the interface seems a little unMoose-ish. Other than that great contribution. Thanks.
Update: Brian Cassidey has done a great job adopting, maintaining and improving this module.
Previous Review for Version < 2.0:
This module is a quick and dirty solution that has gone unmaintained. There are several bugs that cause it to fail. I tried contacting the author on several occasions and in several locations: cpan, google, module-authors. I was offering to take up maintenance. I could not find him so I have forked the module and am maintaining it as unofficial release version > 2.
Pretty basic but useful Meta-Attribute.
I was thinking I would do something like this and then, story of my life, it is already on CPAN and better than I could have done myself. It is also worth taking a look at the 'self' module which provides self and args as subroutines that can be used without sigils and behave-like special keywords. 'self' on my benchmarks is slightly faster.
Both are great and one or the other should be incorporated in core.
This module is very similar to selfvars. Both modules provide for 'self' and 'args' syntactic sugar. The difference is that this this module vars uses 'self' and 'args' keyword type access, i.e. without the sigil. By contrast, selfvars use the $self, $args and $opt, i.e. variable references with the $ sigil. It is largely a matter of preference, but I like the way the appearance of the code using this module.
Performancewise, this technique is also 11% faster. Here is a benchmark on a Xeon 3.06 GHz box, your mileage may vary.
Rate selfvars-self self-self
selfvars-self 66674/s -- -10%
self-self 74269/s 11% --
threads::shared is the easiest way to share data and threads. Job well done.
I have used this in a production environment on Linux and Solaris boxes. Thanks.
What!?!! I can only give it five stars?
Documentation is a bit weird and getting used to the framework can take a day or two, but if you are not writing your Perl code in Moose, you are missing out. Understanding and following the Moose paradigm will make your code mode standard, easier to maintain, better looking, easier to integrate, etc. In short, this module will make you a better programmer.