in reply to A Class:: module I don't want to write

When I was in a similar situation, I decided to write my own simple method-maker. It's worked out well for me.

(Edit: Just to clarify my reasoning)

I also used Class::MethodMaker originally. The kinds of methods I wanted to create were not in the default set, so I ended up writing my own, which is something that Class::MethodMaker is designed to allow. But since the methods I wanted to create were very similar to some of the default Class::MethodMaker types, I thought I should sort of "subclass" those methods types by reusing some of their code--another thing that Class::MethodMaker allows.

But the end result was pretty ugly. It was hard to look at my custom method types and understand what they actually did without thoroughly knowing the Class::MethodMaker internals. The methods were filled with tons of "macros" (special tokens understood by Class::MethodMaker) imported from the default method types. It worked, but it was kind of a mess.

Then I thought a better approach would be to write my own method types from scratch instead of trying to reuse code bits from the default types. At that point, I began to consider exactly what I was gaining by using Class::MethodMaker. When Class::MethodMaker 2.x development started (I was using 1.x) and backwards compatibility was only promised to "mostly" work, I decided to just write my own, simple method maker that did exactly what I wanted. So that's what I did, and I uploaded it to CPAN (plus a simple object base class that I also use). Like I said, it's worked out well for me. If anyone else wants to use my method maker, that's great. If not, I'm still happy with it.

  • Comment on Re: A Class:: module I don't want to write