call: foo( $obj->{dbh} );
First of all, the dbh is already a reference. There is
no point in creating another one.
Secondly, when you pass variables as arguments to a
perl function, it actually operates on the variable.
If you modify the variable, the variable is modified
in the callers context. You may want to assign the
dbh to a local (lexical) variable to avoid modifying
the original.
regards,
David
--- Alec Brecher <[EMAIL PROTECTED]> wrote:
> 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
>
>