On Sat, 15 Jan 2005, Nicolay A. Vasiliev wrote: > Is this correct to pass DB handle ($dbh) as subroutine parameter? I > don't want to make DB connection everytime when I need to get some > data from DB. But if I connected once I'd like to pass one db handler. Of course you can, and should, do things this way.
Typical generic DBI code for me might look something like this: my $dbh = get_database_connection; my $sth = get_statement( $dbh ); do_stuff_with( $sth ); $sth = get_new_statement( $dbh ); do_more_stuff_with( $sth ); do_something_else_with( $sth ); Etc., where the subroutines are defined later, and the database and statement handles get declared once and then passed around as needed. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>