package Parent;
use strict;
use warnings;
use Class::MethodMaker
new_hash_init => 'new',
get_set => [qw( color )];
sub init {
my $self = shift();
print STDERR "initializing parent\n";
my %values = @_;
$self->color($values{color});
}
1;
####
package Child;
use strict;
use warnings;
use Class::MethodMaker
new_hash_init => 'new',
get_set => [qw( shape )];
use base qw( Parent );
sub init {
my $self = shift();
my %values = @_;
$self->SUPER::init(color => ($values{color}));
$self->shape($values{shape} || 'square');
}
1;
####
use strict;
use warnings;
use Parent;
use Child;
my $p = new Parent(color => 'green');
my $c = new Child(shape => 'round', color => 'red');
print $p->color(), "\n";
print $c->color(), ", ", $c->shape(), "\n";