hesco has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on an application which has outgrown its previous configuration arrangement. I'm now getting the following error, on the following line, which is calling the subroutine reproduced below.
How can I make this error go away and this script give me my database connection from the new configuration scheme? Why does it wait till the db_name to choke, while allowing the db_host_name to pass through without complaint?
-- Hugh
Software error:
Can't use string ("databasename ") as a HASH ref while "strict refs" in use at /usr/lib/cgi-bin/bc/supporters.cgi line 265.
(Yes, I see that I still need to strip that trailing space. That is a different issue, I think).
line 265 reads:
that subroutine reads:my $dbh = vol::connect_new($config{'db'}{qw(db_host_name db_name db_us +er db_pw)});
sub connect_new { my($host,$db,$user,$pw) = @_; # my $host = "$config{'db'}{'db_host_name'}"; # my $db = "$config{'db'}{'db_name'}"; # my $user = "$config{'db'}{'db_user'}"; # my $pw = "$config{'db'}{'db_pw'}"; my $dsn = "DBI:mysql:host=$host;database=$db"; return (DBI->connect($dsn,$user,$pw, {PrintError => 0, RaiseError => 1})); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't use string ("") as a HASH ref while "strict refs"
by bart (Canon) on Nov 26, 2005 at 00:13 UTC | |
by hesco (Deacon) on Nov 26, 2005 at 01:46 UTC | |
by ikegami (Patriarch) on Nov 26, 2005 at 03:27 UTC | |
by hesco (Deacon) on Nov 26, 2005 at 05:08 UTC | |
by ikegami (Patriarch) on Nov 26, 2005 at 05:15 UTC | |
| |
by bart (Canon) on Nov 26, 2005 at 09:16 UTC | |
|
Re: Can't use string ("") as a HASH ref while "strict refs"
by bradcathey (Prior) on Nov 26, 2005 at 00:01 UTC |