create table my_database..foo ( bar int , baz varchar(10) ) #### use Table ( { -dbase => "my_database", -table => "foo" } ); my $f = my_database::foo->new( { bar => 1, baz => "neat" } ); #### #Table's import method sub import { my ( $class, @args ) = @_; my $href = $args[0]; #sanity checking on href... my ( $dbase, $table ) = ( $args->{-dbase}, $args->{table} ); #get_columns returns a reference to an array #containing the columns. my $columns = get_columns( $dbase, $table ); #this is where I get stuck. package $dbase::$table; @ISA = qw(Table); use Class::MethodMaker; make methods get_set => $columns, new_hash_init => 'init'; #broquaint suggested this, but he didn't like it #"this is just so very very wrong" --broquaint #the idea is to export the $dbase::$table package #definition to the caller *{"main::$dbase::$table::"} = *{"$dbase::table"}; } #### use Table ( { -dbase => "mydb", -table => "foo" } ); use Table ( { -dbae => "someotherdb", -table => "bar" } ); #results in the exporting of 2 class definitions: #mydb::foo and someotherdb::bar #### package mydb::foo; @ISA = qw(Table); package someotherdb::bar; @ISA = qw(Table);