reading a zip from an IO::Scalar in 5.8

K

Kevin

perl, v5.8.3
Archive-Zip-1.13

How do I need to change the code given in the Archive::Zip examples
directory to make it work with perl 5.8? It works ok on machines with
5.6 and I'm assuming that it's a problem caused by changes in 5.8.

When I try to run the readScalar.pl code I get:

Read 20000 bytes
error: file not seekable
Archive::Zip::Archive::readFromFileHandle('Archive::Zip::Archive=HASH(0x92ebd98)','IO::Scalar=GLOB(0x90de7d4)')
called at ./readScalar.pl line 20

(this is the code):

#!/usr/bin/perl -w
# Demonstrates reading a zip from an IO::Scalar
# $Revision: 1.4 $
use strict;
use Archive::Zip qw:)CONSTANTS :ERROR_CODES);
use IO::Scalar;
use IO::File;

# test reading from a scalar
my $file = IO::File->new('testin.zip', 'r');
my $zipContents;
binmode($file);
$file->read($zipContents, 20000);
$file->close();
printf "Read %d bytes\n", length($zipContents);

my $SH = IO::Scalar->new(\$zipContents);

my $zip = Archive::Zip->new();
$zip->readFromFileHandle( $SH );
my $member = $zip->addString('c' x 300, 'bunchOfCs.txt');
$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
$member = $zip->addString('d' x 300, 'bunchOfDs.txt');
$member->desiredCompressionMethod(COMPRESSION_DEFLATED);

$zip->writeToFileNamed('test2.zip');
 
S

Sisyphus

Kevin said:
perl, v5.8.3
Archive-Zip-1.13

How do I need to change the code given in the Archive::Zip examples
directory to make it work with perl 5.8? It works ok on machines with
5.6 and I'm assuming that it's a problem caused by changes in 5.8.

Second attempt at posting - apologies if the first attempt shows up as
well. (Never use Mozilla .... for *anything* !!!)

I find no problem with the script on both perl 5.6.1 and perl 5.8.5 so
long as "testin.zip" is no larger than the number of bytes being read
(20,000 in the example given).

I'm on Windows2000.

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,427
Latest member
HildredDic

Latest Threads

Top