use strict; use warnings; # ABSTRACTION package My::Lesson; sub new{ my $class = shift; return bless { steps => [] }, $class; } sub add_step{ my $self = shift; push @{ $self->{ steps }}, @_; } # INCARNATION package My::Lesson::Example; our @ISA = ( 'My::Lesson' ); sub new{ my $class = shift; my $self = $class->SUPER::new; $self->add_step('one','two'); return $self; } # USAGE # Please note that this is only an example of usage. The real one will be done by an object of the Perl::Teacher class, like in # # $teacher->current_lesson( My::Lesson::Example->new ) # # or something similar package main; my $lesson = My::Lesson::Example->new;