#!/usr/bin/perl use Carp; # *Class::DBI::_croak = \&Carp::croak; use Indyvoter::Object; use strict; use warnings; Indyvoter::Store->set_db( "dbi:mysql:indyvoter", "indyvoter", "b3rn4l" ); my @tables = ( { name => "User", title => "User", properties => [ { name => "first", title => "First Name", store_type => "varchar(100)" }, { name => "last", title => "Last Name", store_type => "varchar(100)" }, ] }, { name => "Organization", title => "Organization", properties => [ { name => "name", title => "Name", store_type => "varchar(100)" }, { name => "organizer", title => "Organizer", relation => "has_a" }, { name => "members", title => "Members", range => "User", relation => "has_many" }, ] }, ); for my $tab (@tables) { my $props = delete $tab->{properties}; my $class = Indyvoter::Store->create( Class => $tab ); $class->add_to_properties($_) for @$props; }