package Table; use Moose::Role; use Moose::Exporter; use DBI; Moose::Exporter->setup_import_methods( with_caller => ['parse_table'], also => 'Moose', ); sub parse_table { my $table = shift; my $dbh = DBI->connect( ... ); my $sth = $dbh->selectall_arrayref( "describe $table" ); # loop thru $sth and add Moose attributes }