Subject: | warning is displayed due to undefined value being used in an array index |
Date: | Thu, 25 Oct 2018 00:21:54 +0200 |
To: | bug-SQLite_File [...] rt.cpan.org |
From: | Luc Vereecken <kineticluc [...] gmail.com> |
Hi,
SQLite_File version 1005
A warning is generated due to an undef value in $i at line 1671 in
SQLite_File.pm, when deleting an (existing) element in a tied hash. The
bug only manifests itself after the SQLite file has been closed and
re-opened. The value is correctly deleted, as far as I can tell.
Below is a functioning program illustrating that the delete() works
without warning in a newly created file, but generates the warning in a
re-opened file.
My apologies for not providing a patch... I can't spare the time at the
moment.
Best wishes,
Luc Vereecken
-----------
#!/usr/bin/perl -w
use strict;
use warnings;
use SQLite_File;
use Fcntl;
my %cache;
tie (%cache, 'SQLite_File', "test.sqlite", (O_RDWR|O_CREAT), 0666);
$cache{123}="data";
print "$cache{123}\n";
delete $cache{123};
# Does not print a warning
$cache{123}="data";
untie %cache;
tie (%cache, 'SQLite_File', "test.sqlite", (O_RDWR|O_CREAT), 0666);
print "$cache{123}\n";
delete $cache{123};
# Prints: "Use of uninitialized value $i in array element at /usr/lib
# /perl5/site_perl/5.18.2/SQLite_File.pm line 1671."
--------