in reply to OO Design Question

In stead of holding onto the model name, you could hold on to the resources that the model gives you. In this case (simplification?) its just one sub that you keep around and dispatch to.
new { my ($class, $conf_file) = @_; my $opts = read_conf( $conf_file ); $opts->{model_trainer} = eval sprintf q{ require %s; \&%s::train }, ($opts->{model}) x 2; # ... validation ... bless $opts, $class; } sub train { my $self = shift; my $data = voodoo( shift ); $self->{model_trainer}->( $self, $data ); }
I don't really like using eval much. There's probably a better way to get a hard ref to the train function, but I don't see it right now.