CPAN Module Review: Class::MOP

by chromatic

Perhaps my keenest frustration with Perl 5 is its lack of a clean metaprogramming facility. Stevan Little's Class::MOP has filled in much of the gap. Here's what I learned after playing with it for an afternoon.


4 Comments

nothingmuch
2006-06-20 14:57:44
I didn't try Class::MOP for defining new classes and creating new objects (it's awfully verbose, and I don't have a project where that's useful at the moment)


You should mention Moose, which provides a Perl 6 inspired declarative sugar layer over Class::MOP.


chromatic
2006-06-21 16:04:23
Yuval, I'd hate to ruin the surprise of what I shall review next!
Mark Stosberg
2006-07-06 05:27:33
Regarding benchmarking: A couple of use benchmarked a replacement of Class::ISA::super_path with Class::MOP's "class_precendence_list". In these casual tests, Class::MOP was 25 to 50% slower.


I agree Class::MOP is clean and nice, but I won't be switching performance-sensitive code over to use it just yet.

chromatic
2006-07-06 12:02:45
Thanks for the data point, Mark. I talked to Stevan about this last week at YAPC::NA, and he has some strategies to optimize the code.


I also offered to write a few parts in XS, if that would help. So far, his goal has been completeness and accuracy instead of speed. Hopefully convenience is possible without too much penalty.