[32443] in Perl-Users-Digest
Perl-Users Digest, Issue: 3710 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 9 14:09:15 2012
Date: Sat, 9 Jun 2012 11:09:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 9 Jun 2012 Volume: 11 Number: 3710
Today's topics:
Re: How can I type in input to a perl pgm that is eithe <kquirici@yahoo.com>
Re: using Archive::Zip::MemberRead fails to find "opene <Paul.Marquess@btinternet.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 8 Jun 2012 12:31:11 -0700 (PDT)
From: kquirici <kquirici@yahoo.com>
Subject: Re: How can I type in input to a perl pgm that is either invisible or masked - i.e., for a password
Message-Id: <cf4de6ea-d6b0-4ca2-a49b-d21dcdae4446@googlegroups.com>
On Friday, June 8, 2012 2:15:48 PM UTC-4, Dave Saville wrote:
> On Fri, 8 Jun 2012 17:11:12 UTC, kquirici <kquirici@yahoo.com> wrote:
>
> > The subject pretty much says it all. I want to write a perl program that accepts typed-in input except that the input is invisible or masked.
> >
> > Any help MUCH appreciated.
> >
>
> Well "perl input password" in google might be a good starting point
> :-)
>
> --
> Regards
> Dave Saville
It WAS a good starting point. In fact there was a nice sample of code for
the MAC which is where I'm working.
Thx (and to Horst since the code sample uses Term::Readkey
Regards,
Ken
------------------------------
Date: Sat, 09 Jun 2012 01:10:28 +0100
From: Paul Marquess <Paul.Marquess@btinternet.com>
Subject: Re: using Archive::Zip::MemberRead fails to find "opened" method
Message-Id: <4FD29474.7010206@btinternet.com>
On 08/06/12 16:55, David Karr wrote:
> On Thursday, June 7, 2012 4:02:20 PM UTC-7, Ben Morrow wrote:
>> Quoth David Karr<davidmichaelkarr@gmail.com>:
>>>
>>> This is the key part of it:
>>>
>>> for my $archiveMember (@matchingArchiveList) {
>>> #print "archiveMember[" . $archiveMember->fileName() . "]\n";
>>> my $tempArchiveName = prepareTempFile();
>>> #print "tempArchiveName[" . $tempArchiveName . "]\n";
>>> $zip->extractMemberWithoutPaths($archiveMember, $tempArchiveName);
>>> my $archiveZip = Archive::Zip->new();
>>> my $archiveStatus = $archiveZip->read($tempArchiveName);
>>> if ($archiveStatus == AZ_OK) {
>>> processArchive($archiveZip, $entry, $zipName . ":" .
>>> $archiveMember->fileName());
>>> unlink($tempArchiveName);
>>
>> This unlink probably wants to be outside the if. If (say) the internal
>> zipfile is corrupted, and can't be read, you still need to clean up the
>> tempfile.
>
> I was thinking about that, but I assume that it would fail if the file didn't actually get created? I figured I would need some sort of exception handling to do that cleanly (of course, if that was really important, I probably should have already been doing that). I'm not very familiar with how Perl does exception handling.
Here is an alternative implementation that uses IO::Uncompress::Unzip to
walk a nested zip files to any depth. It just outputs the name of each
member in all the zip files it finds as a proof of concept.
No temp files needed.
#!/usr/bin/perl
use warnings;
use strict;
use IO::Uncompress::Unzip;
sub walk
{
my $name = shift;
my $fh = shift;
my $length = shift;
my $indent = shift ;
my $unzip = new IO::Uncompress::Unzip $fh,
InputLength => $length
or die "Cannot open zip\n" ;
my $status;
for ($status = 1; $status > 0; $status = $unzip->nextStream())
{
my $name = $unzip->getHeaderInfo()->{Name};
my $len = $unzip->getHeaderInfo()->{CompressedLength};
$len = $len->get32bit() if ref $len eq 'U64';
warn " " x $indent . "Processing member $name $len\n" ;
if ($name =~ /.zip$/)
{
walk($name, $unzip, $len, $indent + 2);
}
else
{
# Deal with the payload if necessary
# my $buff;
# while (($status = $unzip->read($buff)) > 0) {
# # Do something here
# }
}
last if $status < 0;
}
die "Error processing $name: $!\n"
if $status < 0 ;
}
my $file = shift;
my $length = -s $file ;
my $fh ;
open $fh, "<$file" ;
walk($file, $fh, $length, 0);
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 3710
***************************************