On Thu Feb 02 23:18:49 2012, ANDK wrote:
Show quoted text> As per subject.
>
> commit 7e482323fb2aaa4e52b80f3c50b716c8b6ef41c8
> Author: Father Chrysostomos <sprout@cpan.org>
> Date: Tue Jan 10 08:55:08 2012 -0800
>
> [perl #35865, #43011] FETCH after autovivifying
>
> CC'd to sprout, just in case there's something to be tweaked.
This is the error I get when running the tests:
Can't use an undefined value as a HASH reference at /Users/sprout/.cpan/build/IPC-Lite-
0.4.37-hzRWiZ/blib/lib/IPC/Lite.pm line 719.
Line 719 of Lite.pm is:
if (!($st = $db->{_prepped}->{$name})) {
I don’t understand why Lite.pm is looking at this _prepped attribute, which apparently does
not exist, but, since %$db is tied, it ends up calling FETCH, which returns undef. Since this is
in autovivifying context (due to the ->{$name} after it), perl then calls STORE with an empty
hash. In bleadperl, FETCH is then called again, just in case the tied variable wanted to return
something other than the hash that was just assigned (in earlier versions, perl would assume
that the same hash would have been returned, giving the tie class less control, and resulting
in hideous workarounds in some modules). DBI, for some reason (I don’t understand how
DBI’s attributes work), returns undef again. It doesn’t want to store that empty hash. So then
perl croaks because ...->{$name} is being called on undef.
The easiest solution, while keeping the current behaviour, is to change that line to:
if (!($st = ($db->{_prepped}||{})->{$name})) {
But I think that deleting the if() statement and executing the apodosis unconditionally would
accomplish the same thing.
I’ve looked and have not found _prepped anywhere else in the sources for IPC::Lite,
DBD::SQLite and DBI. It looks like a mistake to me. Was it supposed to be
private_ipc_lite_prep?