leocharre has asked for the wisdom of the Perl Monks concerning the following question:
my $DB = ref_to_db(); #at this point it's all good. i can call prepare like # $$DB->prepare(qq| etc etc etc.... #this would be fine too closenow(\$$DB); #now... # $DB is a reference to an open DB connection, # how do it reference to it in a hash, pass a reference # to the hash to a sub, then dereference to the DB ???!!! my %Booga - (DB => \$$DB ); closeplease(\%Booga); sub ref_to_db { my $DB = DBI->connect("DBI:mysql:dat...... etc etc return \$DB; } sub closenow { $_[0]->disconnect; } sub closeplease { my $Booga = $_[0]; #im at a loss here, is this way off? $$Booga{DB}->disconnect; }
I don't know where this is breaking my cable, something about it is off- any comments.. The thing is giving me a nervous twitch in my left eye serioulsy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pass reference, to a hash with a reference to an open db handle, to a sub - help
by Tanktalus (Canon) on Mar 06, 2006 at 22:08 UTC | |
|
Re: pass reference, to a hash with a reference to an open db handle, to a sub - help
by Fletch (Bishop) on Mar 06, 2006 at 22:06 UTC |