One purpose of OOP is to enable the maintainer of
Animal or Horse to make
reasonably independent changes to the implementation of the methods
and still have the exported interface work properly. To see why
accessing the hash directly violates this, let's say
that Animal no longer uses a simple color name for
the color, but instead changes to use a computed RGB triple to store
the color (holding it as an arrayref), as in:
use Color::Conversions qw(color_name_to_rgb rgb_to_color_name);
...
sub set_color {
my $self = shift;
my $new_color = shift;
$self->{Color} = color_name_to_rgb($new_color); # arrayref
}
sub color {
my $self = shift;
rgb_to_color_name($self->{Color}); # takes arrayref
}