--- Tom Phoenix <[EMAIL PROTECTED]> wrote:

> On 9/14/06, Derek B. Smith
> <[EMAIL PROTECTED]> wrote:
> 
> > my %subdir_for = (
> >   'bpjava\-msvc'   => 23,
> >  'bpjava\-susvc'   => 24,
> >  'bpjava\-usvc'    => 25,
> > )
> 
> Those backslashes aren't doing anything. But they
> aren't needed,
> either; hyphen isn't a special character in a hash
> key or
> single-quoted string.
> 
> >  ##-- Treat each sequence of whitespace,non-wsp as
> a
> > word --##
> >  my @words = split /\s+|\S+/, $words;
> 
> You probably don't want the second alternative in
> that pattern, since
> it's stealing your words. (Doesn't that split always
> return an empty
> list?)
> 
> >  return $num;
> >
> >
> > sub zipit {
> 
> Huh? Is zipit a sub inside a sub?
> 
> I'm sure there are more bugs, but I hope this will
> get you a little
> closer to a valid solution. Cheers!
> 
> --Tom Phoenix
> Stonehenge Perl Training
> 

zipit is not a sub inside a sub...must of forgot a
curly. 

My main problem is trying to get Archive::Zip to work
on many files under $oldir/$word/*.  I can use
qx(gzip) on $oldir/$word/*, but rather not. As as
small test, I have exclude the hash translation in a
sample file to just include one directory and two
files with no avail.  I used addDirectory, addFile and
membersMatching.  Here is the dumper results from the
test code:


Dump    :$VAR1 = bless( {
'externalFileName' => '/usr/openv/logs/old/admin',
'uncompressedSize' => 0,
'fileName' => '/usr/openv/logs/old/admin/',
'versionNeededToExtract' => 20,
'fileAttributeFormat' => 3,
'compressionMethod' => 0,
'fileComment' => '',
'externalFileAttributes' => 1106051072,
'internalFileAttributes' => 0,
'bitFlag' => 0,
'lastModFileDateTime' => 892175106,
'crc32' => 0,
'versionMadeBy' => 20,
'localExtraField' => '',
'desiredCompressionMethod' => 0,
'compressedSize' => 0,
'desiredCompressionLevel' => 0,
'cdExtraField' => ''
}, 'Archive::Zip::DirectoryMember' );

$VAR1 = bless( {
'externalFileName' => '/usr/openv/logs/old/admin',
'uncompressedSize' => 0,
'fileName' => '/usr/openv/logs/old/admin/',
'versionNeededToExtract' => 20,
'fileAttributeFormat' => 3,
'compressionMethod' => 0,
'fileComment' => '',
'externalFileAttributes' => 1106051072,
'internalFileAttributes' => 0,
'bitFlag' => 0,
'lastModFileDateTime' => 892175106,
'crc32' => 0,
'versionMadeBy' => 20,
'localExtraField' => '',
'desiredCompressionMethod' => 0,
'compressedSize' => 0,
'desiredCompressionLevel' => 0,
'cdExtraField' => ''
}, 'Archive::Zip::DirectoryMember' );


I expect to see two files called log.##### under
/usr/openv/logs/old/admin

#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Data::Dumper;
use Readonly;
use Archive::Zip qw ( :ERROR_CODES :CONSTANTS );

my $zip = Archive::Zip->new();
  #$zip->desiredCompressionMethod(
COMPRESSION_DEFLATED );
  #$zip->desiredCompressionLevel( 9 );
  # add all readable files and directories below . as
xyz/*
  print "Dump\t:", Dumper(my $entry =
$zip->addDirectory ('/usr/openv/logs/old/admin'))
     or die "Failed to add file for archive: $!";
  # and write them into a file
  print "\n", Dumper(my @entry =
$zip->membersMatching('log\.*'));
  #$entry->desiredCompressionLevel(9);
  #$zip->writeToFileNamed('.zip');


__________________________________________________
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>


Reply via email to