Re: Archive::Zip->addTree returned 2

2017-10-05 Thread Shlomi Fish
On Wed, 4 Oct 2017 23:26:31 +0530
Asad  wrote:

> Hi All
> 
> I have perl script abc.pl and module abc.pm . When i execute abc.pl which
> is using one the modules
> 

Hi Asad!

Please see https://github.com/shlomif/how-to-share-code-online and comply with
the instructions there.



> Archive::Zip > I am getting the following errors :
> 
> patch_zip: /Location/patch1//patch1.zip Creating zip file
> /Location/patch1//patch1.zip for apply pwd: The file access
> permissions do not allow the specified action. A process terminated prior
> to completion. pwd: The file access permissions do not allow the specified
> action. pwd: The file access permissions do not allow the specified action.
> error: undef returned by _untaintDir on cwd at
> /Location/lib/Archive/Zip/Archive.pm line 754
> Archive::Zip::Archive::addTree('Archive::Zip::Archive=HASH(0x1113ceee8)',
> '/Location/patch1//')
> 
> 
> Seems to me a permission issue but unable to identify what permission issue
> is there if the Filesystem or directory underneath it .
> 
> How to identify .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Archive::Zip->addTree returned 2

2017-10-04 Thread Andy Bach
patch_zip: /Location/patch1//patch1.zip Creating zip file
/Location/patch1//patch1.zip for apply pwd: The file access
permissions do not allow the specified action. A process terminated prior
to completion. pwd: The file access permissions do not allow the specified
action.

It would help to know which OS you're on, but if you've got actual
"" text in there, that's not going to be allowed. The "<" ">" are
redirects, not allowed file name chars. If you just put that in for the
email (so it was some ID number, say "x"), it's saying you don't have
perms for the dir /Location or Location/patch1 or Location/patch1/x -
either no search or no write permissions.

You could try, on linux
$ touch /Location/patch1//test

and see if what it tells you. Try
$ ls -ld /Location /Location/patch1 /Location/patch1/*


On Wed, Oct 4, 2017 at 12:56 PM, Asad  wrote:

>
> Hi All
>
> I have perl script abc.pl and module abc.pm . When i execute abc.pl which
> is using one the modules
>
> Archive::Zip > I am getting the following errors :
>
> patch_zip: /Location/patch1//patch1.zip Creating zip file
> /Location/patch1//patch1.zip for apply pwd: The file access
> permissions do not allow the specified action. A process terminated prior
> to completion. pwd: The file access permissions do not allow the specified
> action. pwd: The file access permissions do not allow the specified action.
> error: undef returned by _untaintDir on cwd at 
> /Location/lib/Archive/Zip/Archive.pm
> line 754 
> Archive::Zip::Archive::addTree('Archive::Zip::Archive=HASH(0x1113ceee8)',
> '/Location/patch1//')
>
>
> Seems to me a permission issue but unable to identify what permission
> issue is there if the Filesystem or directory underneath it .
>
> How to identify .
>
>
>


-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


Re: Archive::Zip library on Solaris

2010-01-25 Thread Jeff Peng

 I have a Perl Script that uses some of the Archive::Zip's methods for
 reading zip entries. Works fine on Linux, BUT on Solaris, this lib is not
 available in Solaris and I'm not allowed to install any lib in it. Is there
 a way to load the archive::zip lib dinamically, without installing it on the
 OS?

You could download the module and install it by hand under your home
directory.
Then use lib '/path/to/module_dir' to include the directory in the
scripts.

HTH.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Archive::Zip library on Solaris

2010-01-25 Thread Shlomi Fish
On Monday 25 Jan 2010 14:58:49 Jeff Peng wrote:
  I have a Perl Script that uses some of the Archive::Zip's methods for
  reading zip entries. Works fine on Linux, BUT on Solaris, this lib is not
  available in Solaris and I'm not allowed to install any lib in it. Is
  there a way to load the archive::zip lib dinamically, without installing
  it on the OS?
 
 You could download the module and install it by hand under your home
 directory.
 Then use lib '/path/to/module_dir' to include the directory in the
 scripts.
 

Yes, see local-lib:

http://search.cpan.org/dist/local-lib/

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Understand what Open Source is - http://shlom.in/oss-fs

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Archive::Zip library on Solaris

2010-01-25 Thread Bruno
And for uninstall it? Since I'm not allowed to alter the server, I have to
remove the installed lib after using it

On Mon, Jan 25, 2010 at 11:10 AM, Shlomi Fish shlo...@iglu.org.il wrote:

 On Monday 25 Jan 2010 14:58:49 Jeff Peng wrote:
   I have a Perl Script that uses some of the Archive::Zip's methods for
   reading zip entries. Works fine on Linux, BUT on Solaris, this lib is
 not
   available in Solaris and I'm not allowed to install any lib in it. Is
   there a way to load the archive::zip lib dinamically, without
 installing
   it on the OS?
 
  You could download the module and install it by hand under your home
  directory.
  Then use lib '/path/to/module_dir' to include the directory in the
  scripts.
 

 Yes, see local-lib:

 http://search.cpan.org/dist/local-lib/

 Regards,

Shlomi Fish

 --
 -
 Shlomi Fish   http://www.shlomifish.org/
 Understand what Open Source is - http://shlom.in/oss-fs

 Deletionists delete Wikipedia articles that they consider lame.
 Chuck Norris deletes deletionists whom he considers lame.




-- 
Bruno Morelli Vargas
Mail: brun...@gmail.com
Msn: brun...@hotmail.com
Icq: 165055101
Skype: morellibmv


Re: Archive::Zip library on Solaris

2010-01-25 Thread Shlomi Fish
On Monday 25 Jan 2010 15:28:11 Bruno wrote:
 And for uninstall it? Since I'm not allowed to alter the server, I have to
 remove the installed lib after using it
 

Just delete ~/perl5/ or wherever you configured local-lib to install the code 
it installs.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Archive::Zip library on Solaris

2010-01-25 Thread Bruno
This lib is not available as default lib on v5.83 . I have to do everything
considering the default installed libs.
http://search.cpan.org/dist/local-lib/lib/local/lib.pm

On Mon, Jan 25, 2010 at 11:57 AM, Shlomi Fish shlo...@iglu.org.il wrote:

 On Monday 25 Jan 2010 15:28:11 Bruno wrote:
  And for uninstall it? Since I'm not allowed to alter the server, I have
 to
  remove the installed lib after using it
 

 Just delete ~/perl5/ or wherever you configured local-lib to install the
 code
 it installs.

 Regards,

Shlomi Fish

 --
 -
 Shlomi Fish   http://www.shlomifish.org/
 Funny Anti-Terrorism Story - http://shlom.in/enemy

 Deletionists delete Wikipedia articles that they consider lame.
 Chuck Norris deletes deletionists whom he considers lame.




-- 
Bruno Morelli Vargas
Mail: brun...@gmail.com
Msn: brun...@hotmail.com
Icq: 165055101
Skype: morellibmv


Re: Archive::Zip library on Solaris

2010-01-25 Thread Shlomi Fish
On Monday 25 Jan 2010 16:07:55 Bruno wrote:
 This lib is not available as default lib on v5.83 . I have to do everything
 considering the default installed libs.
 http://search.cpan.org/dist/local-lib/lib/local/lib.pm
 

1. The point of local-lib is that you download and install it from the local 
and under-privileged shell account and then follow the instructions to set it 
up and use it to install other libraries. So you can do it all on your under-
privileged account.

2. Perl 5.8.3 is horribly old and broken. There are already perl-5.8.9 and 
perl-5.10.1 . You really should upgrade.

Regards,

Shlomi Fish

 On Mon, Jan 25, 2010 at 11:57 AM, Shlomi Fish shlo...@iglu.org.il wrote:
  On Monday 25 Jan 2010 15:28:11 Bruno wrote:
   And for uninstall it? Since I'm not allowed to alter the server, I have
  
  to
  
   remove the installed lib after using it
  
  Just delete ~/perl5/ or wherever you configured local-lib to install the
  code
  it installs.
  
  Regards,
  
 Shlomi Fish
  
  --
  -
  Shlomi Fish   http://www.shlomifish.org/
  Funny Anti-Terrorism Story - http://shlom.in/enemy
  
  Deletionists delete Wikipedia articles that they consider lame.
  Chuck Norris deletes deletionists whom he considers lame.

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Archive::Zip library on Solaris

2010-01-25 Thread Bruno
Ok, so lets try. Hope it works.

I know this version sucks... but unfortunatelly I don't have the power to
decide which Perl version shall we use on our machines :-P , but my team
will keep trying to convince the big guys to upgrade it.

On Mon, Jan 25, 2010 at 12:26 PM, Shlomi Fish shlo...@iglu.org.il wrote:

 On Monday 25 Jan 2010 16:07:55 Bruno wrote:
  This lib is not available as default lib on v5.83 . I have to do
 everything
  considering the default installed libs.
  http://search.cpan.org/dist/local-lib/lib/local/lib.pm
 

 1. The point of local-lib is that you download and install it from the
 local
 and under-privileged shell account and then follow the instructions to set
 it
 up and use it to install other libraries. So you can do it all on your
 under-
 privileged account.

 2. Perl 5.8.3 is horribly old and broken. There are already perl-5.8.9 and
 perl-5.10.1 . You really should upgrade.

 Regards,

Shlomi Fish

  On Mon, Jan 25, 2010 at 11:57 AM, Shlomi Fish shlo...@iglu.org.il
 wrote:
   On Monday 25 Jan 2010 15:28:11 Bruno wrote:
And for uninstall it? Since I'm not allowed to alter the server, I
 have
  
   to
  
remove the installed lib after using it
  
   Just delete ~/perl5/ or wherever you configured local-lib to install
 the
   code
   it installs.
  
   Regards,
  
  Shlomi Fish
  
   --
   -
   Shlomi Fish   http://www.shlomifish.org/
   Funny Anti-Terrorism Story - http://shlom.in/enemy
  
   Deletionists delete Wikipedia articles that they consider lame.
   Chuck Norris deletes deletionists whom he considers lame.

 --
 -
 Shlomi Fish   http://www.shlomifish.org/
 Why I Love Perl - http://shlom.in/joy-of-perl

 Deletionists delete Wikipedia articles that they consider lame.
 Chuck Norris deletes deletionists whom he considers lame.

 Please reply to list if it's a mailing list post - http://shlom.in/reply .




-- 
Bruno Morelli Vargas
Mail: brun...@gmail.com
Msn: brun...@hotmail.com
Icq: 165055101
Skype: morellibmv


Re: Archive::Zip library on Solaris

2010-01-25 Thread Alan Haggai Alavi
Hello all,

I have a Perl Script that uses some of the Archive::Zip's methods for
reading zip entries. Works fine on Linux, BUT on Solaris, this lib is not
available in Solaris and I'm not allowed to install any lib in it. Is there
a way to load the archive::zip lib dinamically, without installing it on the
OS?

Or, is there any default library on Solaris that I can read zip entries via
filehandlers?

Thanks!

-- 
Bruno Morelli Vargas
Mail: brun...@gmail.com
Msn: brun...@hotmail.com
Icq: 165055101
Skype: morellibmv

Hello Bruno,

Archive::Zip is a pure Perl module. You can download it from CPAN to some path 
where you have rw permissions and untar it. Then, modify @INC to use the 
library. No need to install it.

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Archive::Zip and hash issues

2006-09-14 Thread Tom Phoenix

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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Archive::Zip and hash issues

2006-09-14 Thread Derek B. Smith
--- 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




Re: Archive::Zip and hash issues

2006-09-14 Thread Mumia W.

On 09/14/2006 09:20 AM, Derek B. Smith wrote:

[...]
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.*');


Huh?

MembersMatching should return an empty list because the new 
zip file (object) is empty, and that means that the directory 
entry ($entry) is also empty.



 $zip-writeToFileNamed(@entries)


Huh?

WriteToFileNamed is supposed to take a simple filename 
(string) argument--not an array. Stringification of that array 
would have the effect you complained about.



 or die Failed to write zip file $! if $zip !=
AZ_OK;
}
[...]


Try something like this (but season to taste):

#!/usr/bin/perl
use strict;
use warnings;
use File::Slurp;
use Archive::Zip;
use File::Spec::Functions;

my %subdir_for = (
'fawn-hall' = 41,
'gary-hart' = 59,
'monkey-business' = 81,
);

my $srcdir = catfile($ENV{HOME}, qw(tmp bp));
my $arcfile = catfile($ENV{HOME}, qw(tmp myfile.zip));

my $zip = Archive::Zip-new();
for my $file (keys %subdir_for) {
$zip-addDirectory($subdir_for{$file});
my $source = catfile($srcdir, $file);
my $target = catfile($subdir_for{$file},$file);
$zip-addFile($source,$target);
}
$zip-writeToFileNamed($arcfile);




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Archive Zip

2006-09-12 Thread Derek B. Smith


--- Tom Phoenix [EMAIL PROTECTED] wrote:

 On 9/11/06, Derek B. Smith
 [EMAIL PROTECTED] wrote:
 
  I need to compress a bunch of files, so instead of
  making a system call to gzip I figured to try out
  Archive::Zip.
  After running this code it creates a new file but
 is
  larger in size.
 
 That module automatically uses Compress::Zlib to
 compress the data.
 Were any of the files compressed before you started?
 Compression
 algorithms can't shrink every file, and files that
 have compact
 formats can't be shrunk. If you try collecting the
 files with another
 archiving tool, you should see roughly the same
 results, if they're
 already compact: The archive will be roughly the
 same size as the
 uncompressed data, or a little larger.
 
 Cheers!
 
 --Tom Phoenix

**
Thank you 4 replying!.
The files attributes prior to using gzip were:
-rw-r--r--   1 root   sys9007879 Sep 11
15:24 derek.log

after compression using gzip are:
-rw-r--r--   1 root   sys 393013 Sep 11
15:24 derek.log.gz

as you can see this file was compressed significantly
as it is a large text based file:
#file derek.log
derek.log:  ascii text

Is this code syntactically correct to produce a zipped
file ?  I read the POD and there are no clear
examples. Please help...thank you
derek


#!/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();

# add all readable files and directories
  $zip-addTree( '/usr/local/admin', 'derek' );
  # and write them into a file
  $zip-writeToFileNamed('xxx.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




Re: Archive Zip

2006-09-12 Thread Rob Dixon

Derek B. Smith wrote:


--- Tom Phoenix [EMAIL PROTECTED] wrote:


On 9/11/06, Derek B. Smith
[EMAIL PROTECTED] wrote:


I need to compress a bunch of files, so instead of making a system call to
gzip I figured to try out Archive::Zip. After running this code it creates a
new file but is larger in size.


That module automatically uses Compress::Zlib to compress the data. Were any
of the files compressed before you started? Compression algorithms can't
shrink every file, and files that have compact formats can't be shrunk. If you
try collecting the files with another archiving tool, you should see roughly
the same results, if they're already compact: The archive will be roughly the
same size as the uncompressed data, or a little larger.

Cheers!

--Tom Phoenix



**
Thank you 4 replying!.
The files attributes prior to using gzip were:
-rw-r--r--   1 root   sys9007879 Sep 11
15:24 derek.log

after compression using gzip are:
-rw-r--r--   1 root   sys 393013 Sep 11
15:24 derek.log.gz

as you can see this file was compressed significantly
as it is a large text based file:
#file derek.log
derek.log:  ascii text

Is this code syntactically correct to produce a zipped
file ?  I read the POD and there are no clear
examples. Please help...thank you
derek


#!/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();

# add all readable files and directories
  $zip-addTree( '/usr/local/admin', 'derek' );
  # and write them into a file
  $zip-writeToFileNamed('xxx.zip');


That looks fine to me Derek, but of course it depends on what you're trying to
do! What you have written will add (as your comment says) all readable files and
directories at or below /usr/local/admin. Check the resulting zip file to see if
it has stuff in it you didn't mean to archive.

I wonder if you just meant to zip derek.log? If so, then replace the addTree
method call with

 my $entry = $zip-addFile('/usr/local/admin/derek.log', 'derek.log') or die 
'Failed to add file';

and if you want the target file as small as possible (at the expense of a longer
compression time) then add:

 $entry-desiredCompressionLevel(9);

after the call to addFile and before writeToFileNamed.

HTH,

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Archive Zip

2006-09-12 Thread Derek B. Smith
--- Rob Dixon [EMAIL PROTECTED] wrote:

 Derek B. Smith wrote:
 
  --- Tom Phoenix [EMAIL PROTECTED] wrote:
 
 On 9/11/06, Derek B. Smith
 [EMAIL PROTECTED] wrote:
 
 I need to compress a bunch of files, so instead
 of making a system call to
 gzip I figured to try out Archive::Zip. After
 running this code it creates a
 new file but is larger in size.
 
 That module automatically uses Compress::Zlib to
 compress the data. Were any
 of the files compressed before you started?
 Compression algorithms can't
 shrink every file, and files that have compact
 formats can't be shrunk. If you
 try collecting the files with another archiving
 tool, you should see roughly
 the same results, if they're already compact: The
 archive will be roughly the
 same size as the uncompressed data, or a little
 larger.
 
 Cheers!
 
 --Tom Phoenix
 
 
  **
  Thank you 4 replying!.
  The files attributes prior to using gzip were:
  -rw-r--r--   1 root   sys9007879 Sep
 11
  15:24 derek.log
 
  after compression using gzip are:
  -rw-r--r--   1 root   sys 393013 Sep
 11
  15:24 derek.log.gz
 
  as you can see this file was compressed
 significantly
  as it is a large text based file:
  #file derek.log
  derek.log:  ascii text
 
  Is this code syntactically correct to produce a
 zipped
  file ?  I read the POD and there are no clear
  examples. Please help...thank you
  derek
 
 
  #!/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();
 
  # add all readable files and directories
$zip-addTree( '/usr/local/admin', 'derek' );
# and write them into a file
$zip-writeToFileNamed('xxx.zip');
 
 That looks fine to me Derek, but of course it
 depends on what you're trying to
 do! What you have written will add (as your comment
 says) all readable files and
 directories at or below /usr/local/admin. Check the
 resulting zip file to see if
 it has stuff in it you didn't mean to archive.
 
 I wonder if you just meant to zip derek.log? If so,
 then replace the addTree
 method call with
 
   my $entry =
 $zip-addFile('/usr/local/admin/derek.log',
 'derek.log') or die 'Failed to add file';
 
 and if you want the target file as small as possible
 (at the expense of a longer
 compression time) then add:
 
   $entry-desiredCompressionLevel(9);
 
 after the call to addFile and before
 writeToFileNamed.
 
 HTH,
 
 Rob
 
**
Rob, 

Initially I was playing with addFile but opted for the
addTree...anyway your ideas did the trick...thank you!
 
 
 


__
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




Re: Archive Zip

2006-09-11 Thread Tom Phoenix

On 9/11/06, Derek B. Smith [EMAIL PROTECTED] wrote:


I need to compress a bunch of files, so instead of
making a system call to gzip I figured to try out
Archive::Zip.
After running this code it creates a new file but is
larger in size.


That module automatically uses Compress::Zlib to compress the data.
Were any of the files compressed before you started? Compression
algorithms can't shrink every file, and files that have compact
formats can't be shrunk. If you try collecting the files with another
archiving tool, you should see roughly the same results, if they're
already compact: The archive will be roughly the same size as the
uncompressed data, or a little larger.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Archive

2005-12-02 Thread Elie De Brauwer

Brent Clark wrote:

Hi

Anyone know if theres an archive link for this mailing list.

Kind Regards
Brent Clark



What about http://groups.google.com/group/perl.beginners?lnk=sg ?

hth
E.

--
Elie De Brauwer


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Archive

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Brent Clark [EMAIL PROTECTED] wrote:
 Anyone know if theres an archive link for this mailing list.

You can find The Perl Mailing List Database at
  http://lists.perl.org
and from there
  http://lists.cpan.org/showlist.cgi?name=beginners
where you will find the archives
  http://www.mail-archive.com/beginners%40perl.org/
  http://nntp.perl.org/group/perl.beginners

Cheers,
Adriano.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Archive

2005-12-02 Thread Chris Devers
On Fri, 2 Dec 2005, Brent Clark wrote:

 Anyone know if theres an archive link for this mailing list.
 
Presumably :-)

Tried Google?

http://www.google.com/search?q=perl+beginners+mailing+list+archive

That refers, among other things, to the following FAQ entry:

1.4 - Is there an archive on the web?

Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

http://learn.perl.org/beginners-faq#1.4%20%20is%20there%20an%20archive%20on%20the%20web

The develooper.com URL now redirects to nntp.perl.org:

http://www.nntp.perl.org/group/perl.beginners/

Which has the archive you're looking for.

Ain't Google a marvelous thing? :-)



-- 
Chris Devers

2þç/VQÈÑýBU~
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


Re: Archive::TAR with better performance ?

2004-03-10 Thread Wiggins d Anconia


 
 Hi all, 
 
 Is there a way to tar files without using the Archive::TAR module which is
 known to be very slow and ressource guzzler (comment in the faq). 
 
 I am looking for a Perl module directly linked to the C library of tar to
 have almost the same performance and the power of perl ?
 
 Thanks in advance
 
 Michel
 

Well since you framed the question in this manner, aka you know about
the module, I hope have tested it to see if it works for your stuff, and
rejected it for a good reason, why not shell out? (I know, I know)...

But Perl does have this capability and is probably better at it than
other languages, just make sure you do the proper amount of work with
it. Aka use full paths, taint checking, check return codes, etc.

perldoc -f system

There has to be a good reason why there isn't an XS tar, not that I know
what it is

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Archive::Zip funnny return status

2003-08-14 Thread Dan Muey

  I think your pattern match will only catch a literal AZ_OK,
  not the constant.  And I'm not sure, but AZ_OK might evaluate 
  to 0.  At least I think I remember having trouble with that 
  module because it returns 0 on success, and I kept testing 
  for TRUE/FALSE based on the return status.
 
 Oh it's a constant! Thanks Tim! I thought it was awfully 
 starnge that it was using numeric operators. I switched to a 
 regex because I kept getting a non digit used with numeric 
 operator with use strict.
 
 So if zero means it worked what means it failed\how can I 
 tell if $rc means 1 or 0 in the traditional sense given the 
 Archive::Zip module's strange return values?
 
 my $rc = $member-extractToFileNamed($unzippedfile);
 

Ok here's what I've found. If I don't permission to create/write $unzippedfile

$rc = 4
If it works I get 
$rc = 0

Any body know of any documentation on the return codes' numbers and meanings for the 
various Functions of this module? It's cpan page, whileinformative, isn't clear on 
many things like, the return values of functions or actual list of functions and their 
use and meanings.

Thanks
Dan

  use Archive::Zip;
  ...
  my $member = $zip-memberNamed($zippedfile);
  my $rc = $member-extractToFileNamed($unzippedfile);
  if($rc =~ m/AZ_OK/) { print ok -$rc-\n; } else { print
  Bad -$rc-\n; }
  
  The code above *always* prints:
  Bab -0-
  
  But $unzippedfile is created properly, everytime, even if I
  delete it first and run it again!!! So shouldn't $rc have 
  AZ_OK in it or even better be 1 on success? Or is writing the 
  text file in the zip archive to a local text file not 
  success? What could I be doing wrong/missing?
  
  TIA
  
  Dan
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Archive::Zip funnny return status

2003-08-10 Thread wiggins


On Wed, 6 Aug 2003 11:33:18 -0500, Dan Muey [EMAIL PROTECTED] wrote:

 
   I think your pattern match will only catch a literal AZ_OK,
   not the constant.  And I'm not sure, but AZ_OK might evaluate 
   to 0.  At least I think I remember having trouble with that 
   module because it returns 0 on success, and I kept testing 
   for TRUE/FALSE based on the return status.
  
  Oh it's a constant! Thanks Tim! I thought it was awfully 
  starnge that it was using numeric operators. I switched to a 
  regex because I kept getting a non digit used with numeric 
  operator with use strict.
  
  So if zero means it worked what means it failed\how can I 
  tell if $rc means 1 or 0 in the traditional sense given the 
  Archive::Zip module's strange return values?
  
  my $rc = $member-extractToFileNamed($unzippedfile);
  
 
 Ok here's what I've found. If I don't permission to create/write $unzippedfile
 
 $rc = 4
 If it works I get 
 $rc = 0
 
 Any body know of any documentation on the return codes' numbers and meanings for the 
 various Functions of this module? It's cpan page, whileinformative, isn't clear on 
 many things like, the return values of functions or actual list of functions and 
 their use and meanings.
 

Ah the beauty of open source, when in doubt check the source yourself :-).  And of 
course contribute the docs yourself :-).

Sorry for the non-informative answer but this is probably as good as you can get and 
it appears the module's source is laid out very cleanly.

For instance:

# - begin exportable error codes ---

use constant AZ_OK   = 0;
use constant AZ_STREAM_END   = 1;
use constant AZ_ERROR= 2;
use constant AZ_FORMAT_ERROR = 3;
use constant AZ_IO_ERROR = 4;

# - end exportable error codes -

http://danconia.org



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Archive::Zip funnny return status

2003-08-06 Thread Tim Johnson

If you do a perldoc Archive::Zip (I would print out a hard copy of the
result, it's pretty long), you should get all of the error codes, methods,
etc.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 06, 2003 9:44 AM
To: Dan Muey
Cc: [EMAIL PROTECTED]
Subject: RE: Archive::Zip funnny return status




On Wed, 6 Aug 2003 11:33:18 -0500, Dan Muey [EMAIL PROTECTED] wrote:

 
   I think your pattern match will only catch a literal AZ_OK, not 
   the constant.  And I'm not sure, but AZ_OK might evaluate to 0.  
   At least I think I remember having trouble with that module 
   because it returns 0 on success, and I kept testing for TRUE/FALSE 
   based on the return status.
  
  Oh it's a constant! Thanks Tim! I thought it was awfully
  starnge that it was using numeric operators. I switched to a 
  regex because I kept getting a non digit used with numeric 
  operator with use strict.
  
  So if zero means it worked what means it failed\how can I
  tell if $rc means 1 or 0 in the traditional sense given the 
  Archive::Zip module's strange return values?
  
  my $rc = $member-extractToFileNamed($unzippedfile);
  
 
 Ok here's what I've found. If I don't permission to create/write 
 $unzippedfile
 
 $rc = 4
 If it works I get
 $rc = 0
 
 Any body know of any documentation on the return codes' numbers and 
 meanings for the various Functions of this module? It's cpan page, 
 whileinformative, isn't clear on many things like, the return values 
 of functions or actual list of functions and their use and meanings.
 

Ah the beauty of open source, when in doubt check the source yourself :-).
And of course contribute the docs yourself :-).

Sorry for the non-informative answer but this is probably as good as you can
get and it appears the module's source is laid out very cleanly.

For instance:

# - begin exportable error codes ---

use constant AZ_OK   = 0;
use constant AZ_STREAM_END   = 1;
use constant AZ_ERROR= 2;
use constant AZ_FORMAT_ERROR = 3;
use constant AZ_IO_ERROR = 4;

# - end exportable error codes -

http://danconia.org



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Archive::Zip funnny return status

2003-08-06 Thread Dan Muey
 I think your pattern match will only catch a literal AZ_OK, 
 not the constant.  And I'm not sure, but AZ_OK might evaluate 
 to 0.  At least I think I remember having trouble with that 
 module because it returns 0 on success, and I kept testing 
 for TRUE/FALSE based on the return status.

Oh it's a constant! Thanks Tim! I thought it was awfully starnge that it was using 
numeric operators.
I switched to a regex because I kept getting a non digit used with numeric operator 
with use strict.

So if zero means it worked what means it failed\how can I tell if $rc means 1 or 0 in 
the traditional sense given the Archive::Zip module's strange return values?

my $rc = $member-extractToFileNamed($unzippedfile);

   use Archive::Zip;
   ...
   my $member = $zip-memberNamed($zippedfile);
   my $rc = $member-extractToFileNamed($unzippedfile);
   if($rc =~ m/AZ_OK/) { print ok -$rc-\n; } else { print 
 Bad -$rc-\n; }
 
 The code above *always* prints:
 Bab -0-
 
 But $unzippedfile is created properly, everytime, even if I 
 delete it first and run it again!!! So shouldn't $rc have 
 AZ_OK in it or even better be 1 on success? Or is writing the 
 text file in the zip archive to a local text file not 
 success? What could I be doing wrong/missing?
 
 TIA
 
 Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Archive::Zip funnny return status

2003-08-05 Thread Tim Johnson

I think your pattern match will only catch a literal AZ_OK, not the
constant.  And I'm not sure, but AZ_OK might evaluate to 0.  At least I
think I remember having trouble with that module because it returns 0 on
success, and I kept testing for TRUE/FALSE based on the return status.

-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 05, 2003 2:32 PM
To: [EMAIL PROTECTED]
Subject: Archive::Zip funnny return status


use Archive::Zip;
...
my $member = $zip-memberNamed($zippedfile);
my $rc = $member-extractToFileNamed($unzippedfile);
if($rc =~ m/AZ_OK/) { print ok -$rc-\n; } else { print Bad
-$rc-\n; }

The code above *always* prints:
Bab -0-

But $unzippedfile is created properly, everytime, even if I delete it first
and run it again!!! So shouldn't $rc have AZ_OK in it or even better be 1 on
success? Or is writing the text file in the zip archive to a local text file
not success? What could I be doing wrong/missing?

TIA

Dan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Archive Logs

2002-12-28 Thread Rob Dixon
Erm, is this a trick question Tim? The stuff between your two markers isn't
Perl, it's DOS commands!

If you run it as a batch file it'll throw 'Bad command' errors for each line
beginning with a hash, and then (probably) terminate at the 'exit 0;' line.
The 'tar' command will either throw an error or work, depending on whether
you have a DOS tar utility in your path.

If you give it to Perl, then it will fail in compilation when it comes to
your DOS commands.

It might be nice to see your original Unix version to see where you're
coming from.

Cheers,

Rob


Tim Martin [EMAIL PROTECTED] wrote in message
005601c2aead$eb15e0d0$6401a8c0@pc20010107">news:005601c2aead$eb15e0d0$6401a8c0@pc20010107...
 Hi Folks

 Need help in getting the code to work in a Win32 perl system.
 I was able to get it to work in a Linux system but not on a Windows 2000
 Server.
 Could you folks please review the code between Archive Logs Report and
 exit 0;
 I just gave up and put in the code that works in a shell script.

 Thanks for your help.
 
 ---

 #!/Perl/bin/perl.exe -w

 ###
 #
 # This script moves the working file into a
 # archive directory and place a date stamp
 # on the archive files.
 #
 ###
 ##  Start of Script  ##
 $time_string = time_string();
 ##  Archive Logs Report  ##

 c:
 cd \
 cd \EDS\CLM\Merge_Processing_Area # -- Source location of
 the files to be archive
 tar -czvf c:\EDS\CLM\Weekly_Archive_Logs\%DATE%.tgz * 
 c:\CLM\Weekly.log  # -- Location of archive to be placed with date
 stamp and logged.
 cd \

 exit 0;

 ##  Time stamp  ##
 # Create timestring for log file
 sub time_string {
 my ($time_string, $sc, $mi, $hr, $dy, $mo, $yr);

 ($sc, $mi, $hr, $dy, $mo, $yr) = localtime(time);
 $mo += 1;
 $yr += 1900;
 $time_string = sprintf( %04d%2d%02d,
  $yr, $mo, $dy );
 return $time_string;
 }
 ##  End of Script  ##




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Archive::Tar problems....

2002-12-14 Thread Dr. Poo
Well... here's an update I've found that it's actually the $tar-write() calls 
that are 
slowing the whole operation down... I'm guessing the write actually writes then reads 
the tar again...which as it grows in size, it will take longer and more cpu resources 
to 
read it EACH time... Which could be MANY depending on the number of 'flushes' 
being called. Soo... i removed the flush all together and suprisingly, everything 
worked 
as it should... Funny... I can't rememeber why i first put the flush in there to begin 
with... 
So everything seems Tip-Top... Sorry for the false alarm. (hopefully this isn't a 
double
false alarm.. but i'll be sure to let everyone know!! hehe)

Thanks for listening!
-Chris



On Saturday 14 December 2002 08:01 pm, Dr. Poo wrote:
 My name is Chris, HI!

   I'm working on a backup application... and i'm using your Archive::Tar
 perl module (version .22). My question to you is, how can i flush the in
 memory archive after it has reached a certain condition...say like a
 certain size.

   My problem is this...I'm trying to tar an unknown sized directory (with
 sub directories and sub sub directories, ect) and it can be anywhere from
 under one megabyte to almost a GIG! But i don't exactly have that much RAM
 (memory) if that even matters and after only 5 seconds or so when
 processing a directory that is about 250 megs perl already is taking up
 HUGE amounts of CPU resources (99%)... though strangely it's seems to
 only taking up about 3-5% of available memory. (i have only 64 installed)
 ?? Why ?? I guess i'm not understanding how the module handles the tar in
 memory. I'm getting the cpu and memory stats by watching the unix 'top'
 application.

   I've tried to flush the tar object by calling the following when the
 'buffer' reaches a certain size: $tar-write('foo.tar', 0);
   $tar-remove(($tar-list_files()));
   ...then start adding the remaining files to the emptied $tar object 
(and
 flush again if the buffer exceeds the max size again)

   Which makes everything go REALLY fast... as i want... BUT it actually
 removes the contents of the $tar file, not just from memory.. That doesn't
 make sense to me because the write() method (i thought) wrote what was in
 memory to the file specified So as i see it my 'flush' above would
 first update the tar file with the contents in memory, then remove the
 files in memory, then add the new files to memory and if need be flush
 again.

   Should i flush the 'buffer' into mulitple spanning archives and combine
 them at the end of the whole process? Do you have any ideas?


   Thanks a bundle!
   -Chris

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Archive old files

2001-06-10 Thread Peter Scott

At 03:10 PM 6/10/2001 -0400, Tim Musson wrote:
Anyway, the requirement is to move all files older
   than a specified age to another root folder while retaining the
   entire directory structure.

   For example:
   p: = d:\users\User1\WinNT\System32\notepad.exe
   We want to move it to
   d:\Archive2CD\User1\WinNT\System32\notepad.exe

   Yes, I realize notepad.exe is not a file that would need saving, but
   it is a good example...

   I have code that will produce a CSV file with:
   path,filename,size,date,extension
   C:\WinNT\System32\,notepad.exe,5632,1999/3/27-15:7:10,exe

   I don't find myself looking to modules to do things, but I am hoping
   someone will have a good sugestion.

Not sure why you have the CSV file; I would just have done it all in one go 
to begin with:

use File::Find;
use File::Copy;
use File::Spec::Functions;
use File::Basename;
my $AGE = 2;  # days
finddepth(\mirror, 'd:');

sub mirror {
   if (-M  $AGE) {
 (my $newdir = $File::Find::dir) =~ s/users/Archive2CD/;
 do_dir($newdir);
 copy($_, catfile($newdir, $_));
   }
}

sub do_dir {
   my $dir = shift
   return if -d $dir;
   my $parent = dirname($dir);
   do_dir($parent) unless -d $parent;
   mkdir $dir;
}


Untested, but looks reasonable.  Actually, it looks pretty cruddy with all 
that hair for Win32, but I'm in bed with the 'flu at the moment.

No core function for making a directory hierarchy?  How odd, but I don't 
see one.