Subject: | Reading from IO::Scalar, IO::ScalarArray, or in-memory IO::File not supported (although all those are seekable) |
Reading from IO::Scalar, IO::ScalarArray, or in-memory IO::File through readFromFileHandle is not supported, although all of those are seekable.
I'm trying to use Archive::Zip in combination with MIME::Parser, completely in-memory, without temp files. So I'd like to read the ZIP archive from IO::Scalar and IO::ScalarArray objects, because that is what MIME::Parser generates when not using temp files. But the source code says:
# Attempt to guess whether file handle is seekable.
# Because of problems with Windoze, this only returns true when
# the file handle is a real file.
sub _isSeekable # Archive::Zip
{
my $fh = shift;
if ( UNIVERSAL::isa( $fh, 'IO::Scalar' ) )
{
return 0;
}
...
}
Why is that? IO::Scalar *is* seekable, as is IO::ScalarArray.
Further down it says:
...
elsif ( UNIVERSAL::can( $fh, 'stat' ) )
{
return -f $fh;
}
...
That prevents a work-around of mine, using Perl 5.8 in-memory files:
my $handle = IO::File->new();
open($handle, '+<', \$raw_archive);
because such in in-memory file doesn't stand the -f test.
Could you make IO::Scalar, IO::ScalarArray, or in-memory IO::File work as arguments to the readFromFileHandle() method?