in reply to Class::Methodmaker inheritance
It seems like your subclassing confusion got sorted out. Here is a snippet for 'required' arguments to constructors, using Class::MakeMethods. Check out the Examples about custom initialization for more ideas
package Foo; use Class::MakeMethods::Template::Hash ( 'new --with_init' => 'new', scalar => 'foo', ); sub init { my $self = shift; my %args = @_; die 'I need foo!' unless $args{ foo }; $self->foo( $args{foo} ); }
Basically the constructor hands off value initialization to an init method if asked to. It may be that Class::MethodMaker supports this kind of thing too - I'm not familiar with it.
|
|---|