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
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>