sub run { my $self = shift; my $class = $self->{CGI}->param('area'); # We want to be careful that we're reblessing into a sensible class croak "$class not a subclass of OurParentPackage" unless UNIVERSAL::isa($class, 'OurParentPackage'); bless $self, $class; if ($self->{CGI}->param('act') eq 'add') { $self->add; } else { $self->default; } } package WidgetOne; use base qw(OurParentPackage); sub default { print "WidgetOne default\n" }; sub add { print "WidgetOne add\n" }; package WidgetTwo; use base qw(OurParentPackage); sub default { print "WidgetTwo default\n" }; sub add { print "WidgetTwo add\n" }; ... and so on for the other Widget* classes ...