And here is what it might look like ...
package Table; use MooseX::Role::Parameterized; parameter table_name => ( isa => 'Str', required => 1, ); role { my $p = shift; my $table = $p->table_name; my $dbh = DBI->connect( ... ); my $sth = $dbh->selectall_arrayref( "describe $table" ); my @columns = ... do DBI magic here ... foreach my $col (@column) { has $col->{name} => ( is => 'rw', isa => $col->{type}, default => $col->{default}, ); } }; package MyTable; use Moose; with 'Table' => { table_name => 'my_table' };
In reply to Re^3: Moose + ORM
by stvn
in thread Moose + ORM
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |