sub cgiapp_prerun { my $self = shift; my $dbh = $self->{DBH} = $self->param('DBH'); ### let's check for storage; my $previousClass = $self->query->param('this'); my $className = "DataClasses::${previousClass}"; if ( $className->SUPER::can( 'new' ) and $className->SUPER::can( 'store') ) { my $object = $className->new( DBH => $dbh, REQUEST => $request ); ## the needStorage method allows us to ## have multiple "screens" using the same class ## where not all of them store in the DB $object->store() if $object->needStorage(); } } }