I have a database handle $dbh which is used to run various queries throughout the program's execution.
Is it bad form to do the following?
meaning is it bad to have a global database handle declared via my, that is access in subs. I want to say its not the best thing to do, but I can't find any evidence to support that Thanks for your help, Gry#!/Perl/bin/perl use strict; my $dbh = DBI->connect(XXXX); runSomeQueries(); $dbh->disconnect(); sub runSomeQueries { my $query = "select * from table"; my $sth = $dbh->prepare($query); $sth->execute(); }
In reply to Is this Bad form? (DBI) by Grygonos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |