Subject: | Bug: "Can't use string ("1") as an ARRAY ref while "strict refs"" |
This bug report relates to the symptom which looks like this:
"Can't use string ("1") as
an ARRAY ref while "strict refs" in use at
../perllib/CGI/Application/Plugin/DBH.pm line
42."
Reviewing the code, here's how I suspect this can be reproduced:
1. Initialize the connection with an existing handle:
$self->dbh_config().
This will cause internally the config to set to "1", instead of an
arrayref.
2. Make the connection go away.
3. Call $self->dbh again.
It will notice the connection is no longer pingable and will try to
reconnect. It can't actually do this, because we don't now how to
connect-- we had an existing handle before. It should probably die with
a nice error instead.
In trying to connect again, it assumes "1" is an arrayref of
connection params, and returns the above error.
The workaround seems to be not to configure the handle this way, instead
providing configuration params, or a code ref which returns a handle
when executed.
Mark