P
perlnash
Hi,
I am writing a commercial software in which I need to create a zip file
from a group of files and directories.
I am using this code:-
#!/usr/bin/perl
use warnings;
use strict;
use Archive::Zip qwERROR_CODES :CONSTANTS);
my $noofargs=scalar(@ARGV);
die "format: $0 zipfile.zip file [...]\n"
if ($noofargs < 2);
my $zipfilename = shift(@ARGV);
my $zip = Archive::Zip->new();
foreach my $memberName (map { glob } @ARGV){
if (-d $memberName ){
warn "Can't add tree $memberName\n"
if $zip->addTree( $memberName, $memberName ) != AZ_OK;
}
else{
$zip->addFile( $memberName )
or warn "Can't add file $memberName\n";
}
}
my $status = $zip->writeToFileNamed($zipName);
exit $status;
However, for it, I had to download perl modules Archive::Zip and one
more Compress::lib module from cpn and install them.
I do not want the users of software to have to download and install the
modules not provided by default perl installation. Also I cannot assume
that user has net connectivity. Can someone suggest a way out?
May be I can provide the required perl modules with my script, but then
will the user need to manually install these modules, I am not able to
figure out how to do that. I also want my software to be portable i.e.
to be runnable on windows and linux. Please suggest a solution.
Thanks,
perlnash.
I am writing a commercial software in which I need to create a zip file
from a group of files and directories.
I am using this code:-
#!/usr/bin/perl
use warnings;
use strict;
use Archive::Zip qwERROR_CODES :CONSTANTS);
my $noofargs=scalar(@ARGV);
die "format: $0 zipfile.zip file [...]\n"
if ($noofargs < 2);
my $zipfilename = shift(@ARGV);
my $zip = Archive::Zip->new();
foreach my $memberName (map { glob } @ARGV){
if (-d $memberName ){
warn "Can't add tree $memberName\n"
if $zip->addTree( $memberName, $memberName ) != AZ_OK;
}
else{
$zip->addFile( $memberName )
or warn "Can't add file $memberName\n";
}
}
my $status = $zip->writeToFileNamed($zipName);
exit $status;
However, for it, I had to download perl modules Archive::Zip and one
more Compress::lib module from cpn and install them.
I do not want the users of software to have to download and install the
modules not provided by default perl installation. Also I cannot assume
that user has net connectivity. Can someone suggest a way out?
May be I can provide the required perl modules with my script, but then
will the user need to manually install these modules, I am not able to
figure out how to do that. I also want my software to be portable i.e.
to be runnable on windows and linux. Please suggest a solution.
Thanks,
perlnash.