DBD::File supports locking of files used as tables. That flag is stored
as f_lock: 0 no locking, 1: shared lock, 2: exclusive lock
When a io handle is opened as ScalarIO
open my $fh, "<", \$data;
locking will hang the operation, so we have to disable locking or die
or croak or whatever, but not try to lock.
Is below change sane?
DBI test suite still passes, and a test I added in DBD::CSV now passes.
diff --git a/lib/DBD/File.pm b/lib/DBD/File.pm
index 590a351..7f67730 100644
--- a/lib/DBD/File.pm
+++ b/lib/DBD/File.pm
@@ -475,6 +475,11 @@ sub open_data
$flags->{dropMode} and croak "Can't drop a table in stream";
my $fn = "file handle " . fileno ($meta->{f_file});
+ eval {
+ grep { $_ eq "perlio" } PerlIO::get_layers ($meta->{f_file}) and
+ $flags->{f_lock} = 0;
+ };
+
if ($flags->{createMode} || $flags->{lockMode}) {
$meta->{fh} = IO::Handle->new_from_fd (fileno ($meta->{f_file}), "w+")
or
croak "Cannot open $fn for writing: $! (" . ($!+0) . ")";
--
H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/
using perl5.00307 .. 5.19 porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/