I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2007-03-15 15:35:58-07 by stvn in response to 4573
Re: Moose with Module::Refresh; attributes and method modifiers

Ethan,

Thanks for the comments.

Re: Reloading Moose modules and Module::Refresh

I have actually had similar issues with this while using Moose under mod_perl (and Apache::Reload). I will take a closer look into this and see if I can't find the issue. If you have the time to submit a small test, that would be appreciated. You could either send it directly to me (see my CPAN email), to the Moose mailing list (moose-at-perl-dot-org) or join us on irc.perl.org #moose for a more immediate discussion.

Re: Attributes and accessor wrapping

The accessor methods are not actually called within the constructor, the instance is completely constructed by the instance metaclass (see Class::MOP::Instance for more info) and the values are initialized through the attribute metaclasses (see Class::MOP::Attribute::initialize_instance_slot). Using accessors to construct would only work if all your attributes had writeable accessors. You are correct, you would run into heavy introspection with method modifiers which have been attached in subclasses and the constructors trying to determine the calling context, etc. It could be done, but it would slow things down considerably.

I have been pondering a DBIx::Class-style inflate/deflate feature for attributes, which I suspect could be used to solve the problem you are solving with 'around', and anything that didn't solve might be solveable using a custom attribute metaclass, which are not nearly as scary as they sound ;). Again, if you would like to submit some test cases, and we can discuss from there, feel free to email/IRC-nopaste/mailing-list-post away.

Hope this helps.

- Stevan

Direct Responses: Write a response