On Sat Jan 23 03:49:33 2010, cpan@punch.net wrote:
Show quoted text> It would be nice if the default value was set when undef was passed into
> the constructor. (see attached test file)
The above test passes in 0.04. thanks.
An additional test is attached. Apparently the
"around('initialize_instance_slot', sub {"
is not called when "__PACKAGE__->meta->make_immutable;" has been invoked.
tOm on the #moose channel pointed me at
MooseX::Emulate::Class::Accessor::Fast::Meta::Accessor, especially the
"_generate_accessor_method_inline" sub.
see:
http://cpansearch.perl.org/src/FLORA/MooseX-Emulate-Class-Accessor-Fast-0.00903/lib/MooseX/Emulate/Class/Accessor/Fast/Meta/Accessor.pm
irc log:
(10:01:08 PM) th: the around('initialize_instance_slot' ... never gets
called when __PACKAGE__->meta->make_immutable; is set.
(10:01:41 PM) t0m: th: yes.
(10:01:56 PM) t0m: that's as make_immutable inlines stuff for you :)
(10:02:10 PM) t0m: your trait needs to override the generated accessors
(10:02:23 PM) t0m: see MX::Emulate::Class::Accessor::Fast
(10:02:28 PM) th: thanks
(10:02:38 PM) t0m: for the trivial example of mangling that :)
(10:03:02 PM) t0m: might not be quite what you need, but look at that,
then read the code around where it's overriding things :)
(10:05:39 PM) th: so I should be looking at the "around 'BUILD' => sub"
part?
(10:06:27 PM) th: it says (in mk_accessors): confess("You are trying
to modify ${class}, which has been made immutable, this is ". "not
supported. Try subclassing ${class}, rather than monkeypatching it")
if $meta->is_immutable;
(10:06:47 PM) t0m:
http://cpansearch.perl.org/src/FLORA/MooseX-Emulate-Class-Accessor-Fast-0.00903/lib/MooseX/Emulate/Class/Accessor/Fast/Meta/Accessor.pm
(10:07:20 PM) t0m: specifically, the code I wrote below the elucidating
comment 'FIXME - this is shite, but it does work'