Name : perl-Archive-Zip-SimpleZip
| |
Version : 1.000
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.18
| Date : 2024-08-05 19:53:17
|
Group : Unspecified
| Source RPM : perl-Archive-Zip-SimpleZip-1.000-1.18.src.rpm
|
Size : 0.12 MB
| |
Packager : (none)
| |
Summary : Read and Write Zip Archives
|
Description :
Archive::Zip::SimpleZip is a module that allows the creation of Zip archives. For reading Zip archives, there is a companion module, called Archive::Zip::SimpleUnzip, that can read Zip archives.
The module allows Zip archives to be written to a named file, a filehandle or stored in-memory.
There are a small number methods available in Archive::Zip::SimpleZip, and quite a few options, but for the most part all you need to know is how to create a Zip archive and how to add a file to it.
Below is an example of how this module is used to add the two files \"file1.txt\" and \"file2.txt\" to the zip file called \"my1.zip\".
use Archive::Zip::SimpleZip qw($SimpleZipError) ;
my $z = new Archive::Zip::SimpleZip \"my1.zip\" or die \"Cannot create zip file: $SimpleZipError\ \" ;
$z->add(\"/some/file1.txt\"); $z->add(\"/some/file2.txt\");
$z->close();
The data written to a zip archive doesn\'t need to come from the filesystem. You can also write string data directly to the zip archive using the \'addString\' method, like this
use Archive::Zip::SimpleZip qw($SimpleZipError) ;
my $z = new Archive::Zip::SimpleZip \"my2.zip\" or die \"Cannot create zip file: $SimpleZipError\ \" ;
$z->addString($myData, Name => \"file2.txt\");
$z->close();
Alternatively you can use the \'openMember\' option to get a filehandle that allows you to write directly to the zip archive member using standard Perl file output functions, like \'print\'.
use Archive::Zip::SimpleZip qw($SimpleZipError) ;
my $z = new Archive::Zip::SimpleZip \"my3.zip\" or die \"Cannot create zip file: $SimpleZipError\ \" ;
my $fh = $z->openMember(Name => \"file3.txt\");
$fh->print(\"some data\");
print $fh \"more data\" ;
$fh->close() ;
$z->close();
You can also \"drop\" a filehandle into a zip archive.
use Archive::Zip::SimpleZip qw($SimpleZipError) ;
my $z = new Archive::Zip::SimpleZip \"my4.zip\" or die \"Cannot create zip file: $SimpleZipError\ \" ;
my $fh = $z->addFileHandle(FH, Name => \"file3.txt\");
$z->close();
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-A/openSUSE_Tumbleweed/noarch |