Shape is a retangle. Shape::Circle inherits from the Shape.
Is it reasonable?<p>Shape class must have color attibute only.
Shape::Retangle and Shape::Circle should inherit from the Shape.<p>And<p>...<p>package Shape::Retangle;<p>use parent 'Shape';<p>sub new {<p><pre><code> my ($class, $args) = @_;
my $self = $class->SUPER::new( { color => $args->{color} || 'black' } );
$self->{length} = $args->{length} || 1;
$self->{width} = $args->{width} || 1;
return bless $self, $class;
</code></pre>
}<p>...<p>package Shape::Circle;<p>use parent 'Shape';<p>sub new {<p><pre><code> my ($class, $args) = @_;
my $self = $class->SUPER::new( {color => $args->{color} || 'black' } );
$self->{diameter} = $args->{diameter} || 1;
return bless $self, $class;
</code></pre>
}<p>...