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

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

Thread Previous | Thread Next
From:
Robert Davis
Date:
May 22, 2008 06:09
Subject:
RE: BUG? PAR::par_handle($0) on cygwin
Message ID:
3D162396F23CD448B15411C74930C3952DEA7D@usalwexmb2.infor.com


> -----Original Message-----
> From: Steffen Mueller [mailto:wyp3rlx02@sneakemail.com]
> Sent: Wednesday, May 21, 2008 12:27 PM
> To: par@perl.org
> Cc: Robert Davis
> Subject: Re: BUG? PAR::par_handle($0) on cygwin
> 
> 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


I don't know if this helps but here is why I got different results for
how the program was called:

bob@davisrs/c/scripts$ pp -o e.exe -e 'print "\$0=$0\n"; for $k
(%PAR::LibCache) { $v=$PAR::LibCache{$k};print "k=$k;v=$v\n"; }'
bob@davisrs/c/scripts$ ./e
$0=./e.exe
k=/c/scripts/./e.exe;v=Archive::Zip::Archive=HASH(0x10109320)
k=Archive::Zip::Archive=HASH(0x10109320);v=
bob@davisrs/c/scripts$ ./E
$0=./E.exe
k=/c/scripts/./E.exe;v=Archive::Zip::Archive=HASH(0x10109320)
k=Archive::Zip::Archive=HASH(0x10109320);v=
bob@davisrs/c/scripts$ /c/scripts/e
$0=/c/scripts/e.exe
k=/c/scripts/e.exe;v=Archive::Zip::Archive=HASH(0x10109360)
k=Archive::Zip::Archive=HASH(0x10109360);v=
bob@davisrs/c/scripts$ c:/scripts/e
$0=c:/scripts/e.exe
k=c:/scripts/e.exe;v=Archive::Zip::Archive=HASH(0x10109360)
k=Archive::Zip::Archive=HASH(0x10109360);v=

bob

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