On Sat, 10 Apr 2010, Ovid wrote:

I've been playing with Test::Class and discovered that I think I would like a metaclass for it. However, Test::Sweet uses MooseX::Declare (issues with Devel::Cover and PPI). Essentially, I need better ways to store attributes for test classes (so we have a place to store fixtures, if need be) and ways to tag test methods. Is Class::MOP overkill for this (a tutorial would be lovely)? Would using Moose directly be better?

IIUC, you want a to store information about the class, in which case, a metaclass extension is a good way to go.

You probably don't want to try extending Class::MOP metaclasses, Moose provides more hooks for extensions, which can make your life a lot easier.

There are a lot of MooseX modules on CPAN which might be helpful. If you want an example of extending the metaclass to add a _lot_ of new info, take a look at Fey::ORM. All of the ORM meta-info (relationships, inflator/deflators, etc) is stored in metaclasses.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to