#### Class dbi instance script ###### use strict; use CCopy; my $owner_id = shift || die "Must call with a site id to copy to."; my $it = CCopy::Chart->retrieve_all; while (my $chart = $it->next) { *********** $chart->items; *************** } #### #### module ####### package CCopy; use base 'Class::DBI'; CCopy->connection($dsn, $user, $password); package CCopy::Chart; use base 'CCopy'; CCopy::Chart->table('CHART'); CCopy::Chart->columns(Primary => qw/ chart_id /); CCopy::Chart->columns(Essential => qw/ title description owner_id owner_type_id chart_type/); CCopy::Chart->has_many(items => 'CCopy::Chart_Item_XREF'); package CCopy::Chart_Item_XREF; use base 'CCopy'; CCopy::Chart_Item_XREF->table('CHART_ITEM_XREF'); CCopy::Chart_Item_XREF->columns(Primary => qw/ chart_id item_id /); CCopy::Chart_Item_XREF->columns(All => qw/ insert_dtime update_dtime /); ################################ #### ########### CHART ################## chart_id insert_dtime update_dtime owner_id owner_type_id title description featured chart_type ######## CHART_ITEM_XREF ########### chart_id item_id status_code feature_flag priority_level insert_dtime update_dtime locked_flag special_flag mandatory_flag