Hi, I want to fetch a zip file from the net with LWP::UserAgent and then use Archive::Zip to manipulate it. But I don't want to store the zip file on the disk (if possible). This is where IO::Scalar came in. But it seems that Archive::Zip doesn't work together with IO::Scalar. Here is a litte sample code, that demonstrates the problem:
#!/usr/bin/perl use Archive::Zip; use IO::Scalar; use strict; my $zip="test.zip"; open(my $fh, $zip) or die($!); my $zipstring=do{local $/; <$fh>}; close($fh); #tie *ZIP, 'IO::Scalar', \$zipstring; my $scalarfh = new IO::Scalar \$zipstring; my $archive = Archive::Zip->new(); $archive->readFromFileHandle($scalarfh, "foobar?.zip"); __END__ [0]> perl test.pl error: file not seekable at /usr/local/lib/perl5/site_perl/5.8.7/Archive/Zip.pm line 961 Archive::Zip::Archive::readFromFileHandle('Archive::Zip::Archive=HASH(0x82caf1c)', 'IO::Scalar=GLOB(0x823cb38)', 'test.zip') called at test.pl line 17 This is the error I've got. The IO::Scalar manpage says that IO::Scalar filehandles are seekable. Somebody knows any workaround? perl -V is attached. [0]> perl -MArchive::Zip -MIO::Scalar -le 'print $Archive::Zip::VERSION,"\n",$IO::Scalar::VERSION' 1.16 2.110 /GM
Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=freebsd, osvers=5.4-prerelease, archname=i386-freebsd-64int uname='freebsd server 5.4-prerelease freebsd 5.4-prerelease #10: sun apr 17 11:11:38 cest 2005 [EMAIL PROTECTED]:usrobjusrsrcsysserver i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.7/mach -Dprivlib=/usr/local/lib/perl5/5.8.7 -Dman3dir=/usr/local/lib/perl5/5.8.7/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.7/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.7 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.7/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -Doptimize=-O -pipe -O0 -pipe -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O -pipe -O0 -pipe ', cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.4.2 [FreeBSD] 20040728', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil perllibs=-lm -lcrypt -lutil libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.8.7/mach/CORE' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_LARGE_FILES Locally applied patches: defined-or Built under freebsd Compiled at Jun 25 2005 23:32:53 @INC: /usr/local/lib/perl5/site_perl/5.8.7/mach /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl/5.8.6 /usr/local/lib/perl5/site_perl/5.8.5 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.7/BSDPAN /usr/local/lib/perl5/5.8.7/mach /usr/local/lib/perl5/5.8.7 .
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>