Subject: | XBase broken with 'use open ":std" => ":utf8"' |
XBase/Base.pm tries to open DBF files as binary (binmode($fh)), which is
not sufficient when 'use open ":std" => ":utf8"' is set in the
surrounding environment. I suggest to replace "binmode($fh)" with more
explicit "binmode($fh, ':bytes')". Patch attached.
Also, I am not sure about the "unless $external_fh" suffix to the above
bindmode() call. I think DBF files are defined as binary, so it is
perfectly legal for XBase to switch also the pre-existing filehandle to
the binary mode. So my other suggestion is to remove the "unless
$external_fh" clause altogether.
Subject: | DBD-XBase-1.03-utf8.patch |
--- XBase/Base.pm.orig 2011-03-03 20:39:28.000000000 +0100
+++ XBase/Base.pm 2012-06-20 10:24:02.707790548 +0200
@@ -96,7 +96,7 @@
$self->{'tell'} = 0 if $SEEK_VIA_READ;
$fh->autoflush();
- binmode($fh) unless $external_fh;
+ binmode($fh, ':bytes') unless $external_fh;
@{$self}{ qw( fh filename rw ) } = ($fh, $options{'name'}, $rw);
## $self->locksh();