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})); }
In reply to Can't use string ("") as a HASH ref while "strict refs" by hesco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |