develooper Front page | perl.par | Postings from May 2008

Re: BUG? PAR::par_handle($0) on cygwin

Thread Previous | Thread Next
From:
Steffen Mueller
Date:
May 21, 2008 09:27
Subject:
Re: BUG? PAR::par_handle($0) on cygwin
Message ID:
48344D46.4070103@sneakemail.com
Steffen Mueller wrote:
> Since very recently*, there's also the function "get_filehandle" which
> gives you the filehandle to the ZIP member.

[...]

> (I think. Archive::Zip might be doing weird stuff.)

Well, yes, it is. I'll change get_filehandle to find_zip_member and let
the user deal with it. So what you'd do is:

my $memberRead = PAR::find_zip_member("my/file.txt")->readFileHandle();
# $memberRead is now an Archive::Zip::MemberRead
# object, not a FileHandle object!
while (defined($_ = $memberRead->getline()) {
  # do stuff
}

In order to get a *real* file handle, one would have to modify
Archive::Zip itself by adding a class that's a tied file handle which
can uncompress on demand. (Archive::Zip::MemberRead unfortunately
doesn't do this, but I think it could.)

I'm a little uneasy about this since it means exposing even more of the
internal implementation of how PAR treats .par files, but since we
already have PAR::par_handle() returning an Archive::Zip object, I guess
that war was lost a long time ago.

Best regards,
Steffen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About