reading a zip from an IO::Scalar in 5.8

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
perl, v5.8.3

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 code I get:

Read 20000 bytes
error: file not seekable
called at ./ 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('', 'r');
my $zipContents;
$file->read($zipContents, 20000);
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 = $zip->addString('d' x 300, 'bunchOfDs.txt');


Re: reading a zip from an IO::Scalar in 5.8

Kevin wrote:
Quoted text here. Click to load it

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 "" is no larger than the number of bytes being read
(20,000 in the example given).

I'm on Windows2000.


To reply by email u have to take out the u in kalinaubears.

Site Timeline