my $stub = q(
my $stmt = $dbg->prepare("SQL");
$stmt->bind_columns(@_);
$stmt->fetchall_arrayref();
);
while ( my ($name, $sql) = each %queries ) {
my $body = $stub;
$body =~ s/SQL/$sql/;
eval "sub $name { $body }";
}
There seems to be some people objecting to the above in the session on maitainability grounds, but I rather like it.