#!/usr/bin/perl -wT use strict; use DBI; #Global Database Connection string, set in Apache's httpd.conf $ENV{DBI_DSN} ||= 'DBI:mysql(RaiseError=>1,ChopBlanks=>1,Taint=>1,AutoCommit=>1):;mysql_read_default_file=/etc/.my.cnf;database=MyDB'; my $statement = q{ SELECT * FROM table WHERE column = ? }; my @bind_values = qw(value); my $dbh = DBI->connect; my $sth = $dbh->prepare($statement); if(checksums($sth, \@bind_values)) { my $results = computation($sth, \@bind_values); #do something with the $results } $dbh->disconnect; sub checksums { my $sth = shift; my $bind_values = shift; $sth->execute( @$bind_values ); my $results = $sth->fetchall_arrayref({}); #validate the $results return 1; } sub computation { my $sth = shift; my $bind_values = shift; $sth->execute( @$bind_values ); my $results = $sth->fetchall_arrayref({}); #perform computation on the $results return $results; }