Archive::Zip and hash issues



I need some help in this again. Firt I built a hash
consisting of 52 unique subdir names, but 3 of these
sub-dirs have a dash like so bpjava-msvc. During the
translation is the coorect way to ignore the by using
the \?

my %subdir_for = (
'bpjava\-msvc' => 23,
'bpjava\-susvc' => 24,
'bpjava\-usvc' => 25,
)


Finally I have created a subroutine called zipit that
uses Archive::Zip. I need to pass into this routine
all the absolute path names (which includes the file 2
b zipped), but I am getting the raw hash data
returned. archive zip call:
Archive::Zip::DirectoryMember=HASH(0x4086b67c)
archive zip call:
Archive::Zip::DirectoryMember=HASH(0x4086b4f0)

I have tried using the addDirectory method and the
membersMatching method.


snip <...>

sub words_to_num {
my ($words) = @_;

##-- Treat each sequence of whitespace,non-wsp as a
word --##
my @words = split /\s+|\S+/, $words;

##-- Translate each word to its appropriate number
--##
my $num = q{};
foreach my $word (@words) {
my $digit = $subdir_for{ lc $word };
if ( defined $digit ) {
$num .= $digit;
}
}

return $num;


sub zipit {

##-- Add all readable files below $oldir --##
##-- and write them into a file. --##

my $zip = Archive::Zip->new();
my $entry = $zip->addDirectory ("$oldir/$word/")
or die "Failed to add file for archive zip $!";
$entry->desiredCompressionLevel(9);
my @entries = $entry->membersMatching('log.*');
$zip->writeToFileNamed(@entries)
or die "Failed to write zip file $!" if $zip !=
AZ_OK;
}

foreach my $log (@twoweekdir_contents) {
$NBlogs1[$e++] = $log if $log !~ /bpcd|bpdbm|bptm/
and $log =~ /log.\d+/;
}

if (@NBlogs1) {
foreach my $logs1 (@NBlogs1) {
if ($logs1 =~ m{([[:alpha:]]+)/log\.\d+}) {
$word = $1;
$number = $subdir_for{$word};
#print "copy call:\t",Dumper(qx(cp $logs1 $oldir/
$word) );
print "\n";
#print "gzip call:\t",Dumper(qx($gzip
$oldir/$word/*) );
#print "archive zip call:\t",
zipit("$oldir/$word/*");
print "archive zip call:\t", zipit($logs1);
}
}
}


thank you
derek


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.



Relevant Pages

  • Re: Help: -- How to setup sendmail.mc and /etc/mail/authinfo for sbcglobal.net users??
    ... AuthInfo in /etc/mail/authinfo several times, ... FEATURE(`authinfo', `hash /etc/mail/authinfo')dnl ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (Fedora)
  • Hash of Arrays, p. 276
    ... there is an example of a HoA. ... Please look at the definition and initialization of the hash. ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (perl.beginners)
  • Re: whats mistaken?
    ... You need to declare a hash then pass the hash to the getopt() function. ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (perl.beginners)
  • Mac address authntication/ mac address spoffing
    ... network.(if using mac address as credential). ... Does it creates a hash? ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (Security-Basics)
  • Re: god im a noob
    ... The loop variable of a foreach is ... A DBM hash is stored on disk. ... Each invocation of this subroutine has its own %numbers_colors ...
    (comp.lang.perl.misc)