in reply to Stashing DB Key/Value Pairs in Perl Modules
I take it you're talking about something like:
(plus error checking) to dump the database? Yeah, I'd say it was unnatural. There's a reason why databases were invented. This is one of them. Use it. ;-)my $perl = "package Data;\nour %data = (\n"; my $sth = $dbh->prepare('select key,value from data'); $sth->execute(); while (my ($key,$value) = $sth->fetchrow_array()) { $perl .= "\t$key\t=>'$value',\n"; } $perl .= ");\n1;\n"; open my $fh, '>', 'Data.pm'; print $fh $perl;
|
|---|