#! /usr/bin/perl use strict; use warnings; package BackupJob; use base 'Class::DBI'; use CLASS; # the DB where you job table is CLASS->set_db('Main', 'dbi:mysql', 'username', 'password'); # the name of your job table CLASS->table('jobs'); # the columns in your table, primary key first CLASS->columns(All => qw( jobid class classtype client compression elapsed ended filelistcount files fileslastwritten group jobid jobpid jobtype kbytes kbyteslastwritten masterserver operation owner path percent priority retentionperiod retentionunits schedule schedule_type server started state status stunit subtype try try_1_elapsed try_1_ended try_1_fileswritten try_1_kbyteswritten try_1_pid try_1_server try_1_started try_1_status try_1_statuscount try_1_statusdescription try_1_statuslines try_1_stunit trycount )); package main; # If we assume %JOBS us a has mapping # jobid => {column => value, column => value ...} # then the following will create a DB row for each # entry my ($jobid, $values); while ( ($jobid, $values) = each %JOBS ) { BackupJob->create({ jobid => $jobid, %$values }) or die };