The Code
my $schema_name = $s->param('schema_name'); my $finder = Module::Pluggable::Object->new( search_path => 'Winxle::Base::Schema::Result' ); foreach my $base ( 'Winxle::Base::Schema', $finder->plugins ) { my $local = $base; $local =~ s/Winxle::Base::Schema/$schema_name/; eval { Module::Runtime::use_module($local); 1; } or do { Module::Runtime::use_module($base); Class::MOP::Class->create( $local => ( superclasses => [ $base ], # TODO search for local role and apply ) ); }; }