in reply to Moose + ORM
And I can create a class that consumes it: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 }
This compiles. Now it seems all I need to do is what that comment says "loop thru $sth and add Moose attributes" ... but how does one add Moose attributes inside such a role?package MyTable; use Moose; with 'Table'; parse_table( 'my_table' );
Thanks again, you folks help make things like this turn into reusable CPAN modules. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Moose + ORM
by stvn (Monsignor) on Jul 23, 2009 at 21:12 UTC | |
by stvn (Monsignor) on Jul 23, 2009 at 21:16 UTC | |
by Anonymous Monk on Jul 24, 2009 at 12:58 UTC | |
by stvn (Monsignor) on Jul 24, 2009 at 17:15 UTC | |
by Anonymous Monk on Jul 24, 2009 at 20:38 UTC | |
| |
by metaperl (Curate) on Jul 24, 2009 at 12:57 UTC | |
by Anonymous Monk on Jul 24, 2009 at 13:45 UTC |