Search notes:

Perl module Archive::Zip

use warnings;
use strict;

use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
use File::Spec::Functions 'tmpdir';
use File::Basename;



my $dest_file = tmpdir() . '\archive.zip';
my $zip = Archive::Zip->new;
# print dirname($0), "\n";

my $directory_to_zip = File::Spec->catdir($0, '../../..');

# print "directory_to_zip: $directory_to_zip\n";

$zip -> addTree (
  $directory_to_zip,
  '',
  sub { $_ !~ /\.git\b/ }   # exclude «.git» directory
);

# Create a file «42.txt» that does not exist in the
# directory $directory_to_zip.
$zip -> addString('twenty-two', '42.txt');  # Creat

$zip -> writeToFileNamed ($dest_file) == AZ_OK or die "Could not write $dest_file";

print "\n$dest_file written\n\n";
print "Now, use ../Extract/script (Archive::Extract) to unzip again.\n";
Github repository PerlModules, path: /Archive/Zip/script.pl

See also

Perl modules IO::Compress::Zip and Archive::Extract
shell commands zip and unzip
Emailing executables

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1744800101, '13.58.119.156', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/Archive/Zip/index(74): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78