Subject: | Missing BINMODE and FILENO in tie interface |
Thanks for writing this module. I am using it to read
a set of spanned data files where the output of a program
is saved to a sequence of chunk files for robustness in
the event of system failure.
To get the tied handle to work with some other software,
I had to add stub functions supporting binmode() and
fileno(). For my current use, just returning true was
good enough.
However, it seems that the current implementation of
File::LinearRaid requires/assumes binmode on the file
handles opened. Otherwise, the offset arithmetic would
break. Consequently, I think setting binmode() inside
the append and TIEHANDLE routines after the opens would
be correct. Then, BINMODE would, correctly even, just
return true since the files were all opened and
binmode set. You could even return the cumulative AND
of all the binmodes on the file handles.
For fileno(), the dependent code was using fileno($fh) to
check if $fh was a file handle passed into the read routine.
My hacked TIEMODE just returns true since that was all I
needed. A more complete solution might be to expose the
current active file's handle here with a configuration option
to toggle this to return undef since trying to use the
underlying file directly would most probably break things.
--Chris
sub BINMODE {
# This is a stub. Need to implement for real
# to correctly support FlexRaw et. al. For now
# just return true and have hardwired the opens
# in File::LinearRaid to set binmode.
return 1;
}
sub FILENO {
# This is a stub. Need to implement for real
# to correctly support FlexRaw et. al. What
# does the fileno() mean in this case?
return 1;
}