Changes MANIFEST Makefile.PL README lib- |-- Foobar.pm t/ #### use base qw( FooBar ); #### # lib/FooBar.pm package FooBar; sub new { my $class = shift; my $args = shift; my $self = bless { name => $args->{ name }, age => $args->{ age }, }, $class; } return $self; } # lib/FooBar/Foo.pm package FooBar::Foo; use base qw( FooBar ); # no new() sub, it's inhereted sub age { my $self = shift; my $args = shift; $self->{ age } = $args->{ age } if $args->{ age }; return $self->{ age }; } # lib/FooBar/Bar.pm package FooBar::Bar; use base qw( FooBar ); # no new again sub name { my $self = shift; my $args = shift; $self->{ name } = $args->{ name } if $args->{ name }; return $self->{ name }; } # foo.pl use FooBar::Foo; use FooBar::Bar; # don't need to 'use' FooBar here my $foo = FooBar::Foo->new({ name => 'stevieb', age => '35', }; my $current_age = $foo->age(); my $year_older = $foo->age({ age => 36, }); #### perl Makefile.PL sudo make install