This is more of a Perl question than a DBI question.

The dbh handle is a reference.  Therefore, you can pass the reference around, 
assign to local variables, assign to object members, etc. and trust that all 
your references will all point back to the same connection object. 


-----Original Message-----
From: Alec Brecher [mailto:[EMAIL PROTECTED]
Sent: Monday, January 10, 2005 8:35 AM
To: Dbi-Users
Subject: passing dbh


I am trying to figure out the most efficient method of passing around a live
dbh when calling a subs.

I have embedded a dbh into an object: $obj->{dbh} and would like to pass to
it to other functions for reuse.

Should I call: foo( $obj->{dbh} );
or: foo( \$obj->{dbh} );
or something else?

Does the first method copy the dbh and create a new connection?

Thank you.  -Alec

Alec Brecher
E Research Resources
office 802 253-8908

Attachment: Brian Campbell (E-mail).vcf
Description: Binary data

Reply via email to