rkg has asked for the wisdom of the Perl Monks concerning the following question:

Hi --

I am planning on using Class::MethodMaker like this:

package Simple; use constant REQFIELDS => qw(a b); use Class::MethodMaker get_set => [REQFIELDS, qw(c d)], new_with_init => 'new', new_hash_init => 'hash_init'; sub init { my $self = shift; my %values = (@_); foreach (REQFIELDS) { die "$_ doesn't exist" unless exists($values{$_}); } $self->hash_init(%values); return; } 1;
The idea is the object must define certain attributes at creation. Rather than start each class with this idiom, I was thinking of subclassing Class::MethodMaker as per the docs so I could specify certain get_set methods as 'required', such that the class would die if an object was created lacking these arguments.

The docs on subclassing C:MM leave me somewhat befuddled... Can anyone give me some suggestions how might I subclass C:MM to obtain this 'required' method functionality?

Thanks for any suggestions