I'm enjoying the benefits of using Moose, and I wanted to enquire into some of the finer aspects of development with Moose.
Most of it is intuitive and very helpful. My compliments to the developers.
I have a couple of questions nonetheless:
I note that there exists both a trigger and a builder option. The trigger option, by use and testing has become clear. The builder option is somewhat similar, although it is passed as a scalar method name and not a coderef. Why a builder and a trigger option, and what are the finer points of the builder option? I ask as much to divine the intent of and the future direction of the design and development of Moose as for practical reasons.
has 'x' => (is => 'rw', isa => 'HashRef', builder => 'build_x'); has 'y' => (is => 'rw', isa => 'HashRef', trigger => \&y_trigger);
The trigger is as the docs say, "a CODE reference which will be called after the value of the attribute is set. The CODE ref will be passed the instance itself, the updated value and the attribute meta-object."
There is not too much information on builder in the Moose perldoc. Anyone care to elaborate?
Now for a more fun question. Metaclasses have been described as a solution in search of a problem. Anyone care to share any clever problems and solutions using Metaclasses in Moose?
|Replies are listed 'Best First'.|
Re: Moose - nalia
by stvn (Monsignor) on Mar 21, 2008 at 19:19 UTC