{
    "mode": "info",
    "parameter": "Archive::Zip",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/Archive%3A%3AZip/json",
    "generated": "2026-07-05T13:35:13Z",
    "synopsis": "# Create a Zip file\nuse Archive::Zip qw( :ERRORCODES :CONSTANTS );\nmy $zip = Archive::Zip->new();\n# Add a directory\nmy $dirmember = $zip->addDirectory( 'dirname/' );\n# Add a file from a string with compression\nmy $stringmember = $zip->addString( 'This is a test', 'stringMember.txt' );\n$stringmember->desiredCompressionMethod( COMPRESSIONDEFLATED );\n# Add a file from disk\nmy $filemember = $zip->addFile( 'xyz.pl', 'AnotherName.pl' );\n# Save the Zip file\nunless ( $zip->writeToFileNamed('someZip.zip') == AZOK ) {\ndie 'write error';\n}\n# Read a Zip file\nmy $somezip = Archive::Zip->new();\nunless ( $somezip->read( 'someZip.zip' ) == AZOK ) {\ndie 'read error';\n}\n# Change the compression type for a file in the Zip\nmy $member = $somezip->memberNamed( 'stringMember.txt' );\n$member->desiredCompressionMethod( COMPRESSIONSTORED );\nunless ( $zip->writeToFileNamed( 'someOtherZip.zip' ) == AZOK ) {\ndie 'write error';\n}",
    "sections": {
        "NAME": {
            "content": "Archive::Zip - Provide an interface to ZIP archive files.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# Create a Zip file\nuse Archive::Zip qw( :ERRORCODES :CONSTANTS );\nmy $zip = Archive::Zip->new();\n\n# Add a directory\nmy $dirmember = $zip->addDirectory( 'dirname/' );\n\n# Add a file from a string with compression\nmy $stringmember = $zip->addString( 'This is a test', 'stringMember.txt' );\n$stringmember->desiredCompressionMethod( COMPRESSIONDEFLATED );\n\n# Add a file from disk\nmy $filemember = $zip->addFile( 'xyz.pl', 'AnotherName.pl' );\n\n# Save the Zip file\nunless ( $zip->writeToFileNamed('someZip.zip') == AZOK ) {\ndie 'write error';\n}\n\n# Read a Zip file\nmy $somezip = Archive::Zip->new();\nunless ( $somezip->read( 'someZip.zip' ) == AZOK ) {\ndie 'read error';\n}\n\n# Change the compression type for a file in the Zip\nmy $member = $somezip->memberNamed( 'stringMember.txt' );\n$member->desiredCompressionMethod( COMPRESSIONSTORED );\nunless ( $zip->writeToFileNamed( 'someOtherZip.zip' ) == AZOK ) {\ndie 'write error';\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The Archive::Zip module allows a Perl program to create, manipulate,\nread, and write Zip archive files.\n\nZip archives can be created, or you can read from existing zip files.\n\nOnce created, they can be written to files, streams, or strings.\nMembers can be added, removed, extracted, replaced, rearranged, and\nenumerated.  They can also be renamed or have their dates, comments, or\nother attributes queried or modified. Their data can be compressed or\nuncompressed as needed.\n\nMembers can be created from members in existing Zip files, or from\nexisting directories, files, or strings.\n\nThis module uses the Compress::Raw::Zlib library to read and write the\ncompressed streams inside the files.\n\nOne can use Archive::Zip::MemberRead to read the zip file archive\nmembers as if they were files.\n\nFile Naming\nRegardless of what your local file system uses for file naming, names\nin a Zip file are in Unix format (forward slashes (/) separating\ndirectory names, etc.).\n\n\"Archive::Zip\" tries to be consistent with file naming conventions, and\nwill translate back and forth between native and Zip file names.\n\nHowever, it can't guess which format names are in. So two rules control\nwhat kind of file name you must pass various routines:\n\nNames of files are in local format.\n\"File::Spec\" and \"File::Basename\" are used for various file\noperations. When you're referring to a file on your system, use its\nfile naming conventions.\n\nNames of archive members are in Unix format.\nThis applies to every method that refers to an archive member, or\nprovides a name for new archive members. The \"extract()\" methods\nthat can take one or two names will convert from local to zip names\nif you call them with a single name.\n\nArchive::Zip Object Model\nOverview\n\nArchive::Zip::Archive objects are what you ordinarily deal with.  These\nmaintain the structure of a zip file, without necessarily holding data.\nWhen a zip is read from a disk file, the (possibly compressed) data\nstill lives in the file, not in memory. Archive members hold\ninformation about the individual members, but not (usually) the actual\nmember data. When the zip is written to a (different) file, the member\ndata is compressed or copied as needed.  It is possible to make archive\nmembers whose data is held in a string in memory, but this is not done\nwhen a zip file is read. Directory members don't have any data.\n\nInheritance\nExporter\nArchive::Zip                            Common base class, has defs.\nArchive::Zip::Archive               A Zip archive.\nArchive::Zip::Member                Abstract superclass for all members.\nArchive::Zip::StringMember      Member made from a string\nArchive::Zip::FileMember        Member made from an external file\nArchive::Zip::ZipFileMember Member that lives in a zip file\nArchive::Zip::NewFileMember Member whose data is in a file\nArchive::Zip::DirectoryMember   Member that is a directory\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": ":CONSTANTS\nExports the following constants:\n\nFAMSDOS FAUNIX GPBFENCRYPTEDMASK\nGPBFDEFLATINGCOMPRESSIONMASK GPBFHASDATADESCRIPTORMASK\nCOMPRESSIONSTORED COMPRESSIONDEFLATED IFATEXTFILEMASK\nIFATEXTFILE IFABINARYFILE COMPRESSIONLEVELNONE\nCOMPRESSIONLEVELDEFAULT COMPRESSIONLEVELFASTEST\nCOMPRESSIONLEVELBESTCOMPRESSION ZIP64SUPPORTED ZIP64ASNEEDED\nZIP64EOCD ZIP64HEADERS\n\n:MISCCONSTANTS\nExports the following constants (only necessary for extending the\nmodule):\n\nFAAMIGA FAVAXVMS FAVMCMS FAATARIST FAOS2HPFS FAMACINTOSH\nFAZSYSTEM FACPM FAWINDOWSNTFS\nGPBFIMPLODING8KSLIDINGDICTIONARYMASK\nGPBFIMPLODING3SHANNONFANOTREESMASK\nGPBFISCOMPRESSEDPATCHEDDATAMASK COMPRESSIONSHRUNK\nDEFLATINGCOMPRESSIONNORMAL DEFLATINGCOMPRESSIONMAXIMUM\nDEFLATINGCOMPRESSIONFAST DEFLATINGCOMPRESSIONSUPERFAST\nCOMPRESSIONREDUCED1 COMPRESSIONREDUCED2 COMPRESSIONREDUCED3\nCOMPRESSIONREDUCED4 COMPRESSIONIMPLODED COMPRESSIONTOKENIZED\nCOMPRESSIONDEFLATEDENHANCED\nCOMPRESSIONPKWAREDATACOMPRESSIONLIBRARYIMPLODED\n\n:ERRORCODES\nExplained below. Returned from most methods.\n\nAZOK AZSTREAMEND AZERROR AZFORMATERROR AZIOERROR\n",
            "subsections": []
        },
        "ERROR CODES": {
            "content": "Many of the methods in Archive::Zip return error codes. These are\nimplemented as inline subroutines, using the \"use constant\" pragma.\nThey can be imported into your namespace using the \":ERRORCODES\" tag:\n\nuse Archive::Zip qw( :ERRORCODES );\n\n...\n\nunless ( $zip->read( 'myfile.zip' ) == AZOK ) {\ndie \"whoops!\";\n}\n\nAZOK (0)\nEverything is fine.\n\nAZSTREAMEND (1)\nThe read stream (or central directory) ended normally.\n\nAZERROR (2)\nThere was some generic kind of error.\n\nAZFORMATERROR (3)\nThere is a format error in a ZIP file being read.\n\nAZIOERROR (4)\nThere was an IO error.\n\nCompression\nArchive::Zip allows each member of a ZIP file to be compressed (using\nthe Deflate algorithm) or uncompressed.\n\nOther compression algorithms that some versions of ZIP have been able\nto produce are not supported. Each member has two compression methods:\nthe one it's stored as (this is always COMPRESSIONSTORED for string\nand external file members), and the one you desire for the member in\nthe zip file.\n\nThese can be different, of course, so you can make a zip member that is\nnot compressed out of one that is, and vice versa.\n\nYou can inquire about the current compression and set the desired\ncompression method:\n\nmy $member = $zip->memberNamed( 'xyz.txt' );\n$member->compressionMethod();    # return current compression\n\n# set to read uncompressed\n$member->desiredCompressionMethod( COMPRESSIONSTORED );\n\n# set to read compressed\n$member->desiredCompressionMethod( COMPRESSIONDEFLATED );\n\nThere are two different compression methods:\n\nCOMPRESSIONSTORED\nFile is stored (no compression)\n\nCOMPRESSIONDEFLATED\nFile is Deflated\n\nCompression Levels\nIf a member's desiredCompressionMethod is COMPRESSIONDEFLATED, you can\nchoose different compression levels. This choice may affect the speed\nof compression and decompression, as well as the size of the compressed\nmember data.\n\n$member->desiredCompressionLevel( 9 );\n\nThe levels given can be:\n\no   0 or COMPRESSIONLEVELNONE\n\nThis is the same as saying\n\n$member->desiredCompressionMethod( COMPRESSIONSTORED );\n\no   1 .. 9\n\n1 gives the best speed and worst compression, and 9 gives the best\ncompression and worst speed.\n\no   COMPRESSIONLEVELFASTEST\n\nThis is a synonym for level 1.\n\no   COMPRESSIONLEVELBESTCOMPRESSION\n\nThis is a synonym for level 9.\n\no   COMPRESSIONLEVELDEFAULT\n\nThis gives a good compromise between speed and compression, and is\ncurrently equivalent to 6 (this is in the zlib code).  This is the\nlevel that will be used if not specified.\n",
            "subsections": []
        },
        "Archive::Zip Methods": {
            "content": "The Archive::Zip class (and its invisible subclass\nArchive::Zip::Archive) implement generic zip file functionality.\nCreating a new Archive::Zip object actually makes an\nArchive::Zip::Archive object, but you don't have to worry about this\nunless you're subclassing.\n\nConstructor\nnew( [$fileName] )\nnew( { filename => $fileName } )\nMake a new, empty zip archive.\n\nmy $zip = Archive::Zip->new();\n\nIf an additional argument is passed, new() will call read() to read\nthe contents of an archive:\n\nmy $zip = Archive::Zip->new( 'xyz.zip' );\n\nIf a filename argument is passed and the read fails for any reason,\nnew will return undef. For this reason, it may be better to call\nread separately.\n\nZip Archive Utility Methods\nThese Archive::Zip methods may be called as functions or as object\nmethods. Do not call them as class methods:\n\n$zip = Archive::Zip->new();\n$crc = Archive::Zip::computeCRC32( 'ghijkl' );    # OK\n$crc = $zip->computeCRC32( 'ghijkl' );            # also OK\n$crc = Archive::Zip->computeCRC32( 'ghijkl' );    # NOT OK\n\nArchive::Zip::computeCRC32( $string [, $crc] )\nArchive::Zip::computeCRC32( { string => $string [, checksum => $crc ] }\n)\nThis is a utility function that uses the Compress::Raw::Zlib CRC\nroutine to compute a CRC-32. You can get the CRC of a string:\n\n$crc = Archive::Zip::computeCRC32( $string );\n\nOr you can compute the running CRC:\n\n$crc = 0;\n$crc = Archive::Zip::computeCRC32( 'abcdef', $crc );\n$crc = Archive::Zip::computeCRC32( 'ghijkl', $crc );\n\nArchive::Zip::setChunkSize( $number )\nArchive::Zip::setChunkSize( { chunkSize => $number } )\nReport or change chunk size used for reading and writing.  This can\nmake big differences in dealing with large files.  Currently, this\ndefaults to 32K. This also changes the chunk size used for\nCompress::Raw::Zlib. You must call setChunkSize() before reading or\nwriting. This is not exportable, so you must call it like:\n\nArchive::Zip::setChunkSize( 4096 );\n\nor as a method on a zip (though this is a global setting).  Returns\nold chunk size.\n\nArchive::Zip::chunkSize()\nReturns the current chunk size:\n\nmy $chunkSize = Archive::Zip::chunkSize();\n\nArchive::Zip::setErrorHandler( \\&subroutine )\nArchive::Zip::setErrorHandler( { subroutine => \\&subroutine } )\nChange the subroutine called with error strings. This defaults to\n\\&Carp::carp, but you may want to change it to get the error\nstrings. This is not exportable, so you must call it like:\n\nArchive::Zip::setErrorHandler( \\&myErrorHandler );\n\nIf myErrorHandler is undef, resets handler to default.  Returns old\nerror handler. Note that if you call Carp::carp or a similar\nroutine or if you're chaining to the default error handler from\nyour error handler, you may want to increment the number of caller\nlevels that are skipped (do not just set it to a number):\n\n$Carp::CarpLevel++;\n\nArchive::Zip::tempFile( [ $tmpdir ] )\nArchive::Zip::tempFile( { tempDir => $tmpdir } )\nCreate a uniquely named temp file. It will be returned open for\nread/write. If $tmpdir is given, it is used as the name of a\ndirectory to create the file in. If not given, creates the file\nusing \"File::Spec::tmpdir()\". Generally, you can override this\nchoice using the\n\n$ENV{TMPDIR}\n\nenvironment variable. But see the File::Spec documentation for your\nsystem. Note that on many systems, if you're running in taint mode,\nthen you must make sure that $ENV{TMPDIR} is untainted for it to be\nused.  Will NOT create $tmpdir if it does not exist (this is a\nchange from prior versions!). Returns file handle and name:\n\nmy ($fh, $name) = Archive::Zip::tempFile();\nmy ($fh, $name) = Archive::Zip::tempFile('myTempDir');\nmy $fh = Archive::Zip::tempFile();  # if you don't need the name\n\nZip Archive Accessors\nmembers()\nReturn a copy of the members array\n\nmy @members = $zip->members();\n\nnumberOfMembers()\nReturn the number of members I have\n\nmemberNames()\nReturn a list of the (internal) file names of the zip members\n\nmemberNamed( $string )\nmemberNamed( { zipName => $string } )\nReturn ref to member whose filename equals given filename or undef.\n$string must be in Zip (Unix) filename format.\n\nmembersMatching( $regex )\nmembersMatching( { regex => $regex } )\nReturn array of members whose filenames match given regular\nexpression in list context. Returns number of matching members in\nscalar context.\n\nmy @textFileMembers = $zip->membersMatching( '.*\\.txt' );\n# or\nmy $numberOfTextFiles = $zip->membersMatching( '.*\\.txt' );\n\nzip64()\nReturns whether the previous read or write of the archive has been\ndone in zip64 format.\n\ndesiredZip64Mode()\nGets or sets which parts of the archive should be written in zip64\nformat: All parts as needed (ZIP64ASNEEDED), the default, force\nwriting the zip64 end of central directory record (ZIP64EOCD),\nforce writing the zip64 EOCD record and all headers in zip64 format\n(ZIP64HEADERS).\n\nversionMadeBy()\nversionNeededToExtract()\nGets the fields from the zip64 end of central directory record.\nThese are always 0 if the archive is not in zip64 format.\n\ndiskNumber()\nReturn the disk that I start on. Not used for writing zips, but\nmight be interesting if you read a zip in. This should be 0, as\nArchive::Zip does not handle multi-volume archives.\n\ndiskNumberWithStartOfCentralDirectory()\nReturn the disk number that holds the beginning of the central\ndirectory. Not used for writing zips, but might be interesting if\nyou read a zip in. This should be 0, as Archive::Zip does not\nhandle multi-volume archives.\n\nnumberOfCentralDirectoriesOnThisDisk()\nReturn the number of CD structures in the zipfile last read in.\nNot used for writing zips, but might be interesting if you read a\nzip in.\n\nnumberOfCentralDirectories()\nReturn the number of CD structures in the zipfile last read in.\nNot used for writing zips, but might be interesting if you read a\nzip in.\n\ncentralDirectorySize()\nReturns central directory size, as read from an external zip file.\nNot used for writing zips, but might be interesting if you read a\nzip in.\n\ncentralDirectoryOffsetWRTStartingDiskNumber()\nReturns the offset into the zip file where the CD begins. Not used\nfor writing zips, but might be interesting if you read a zip in.\n\nzipfileComment( [ $string ] )\nzipfileComment( [ { comment => $string } ] )\nGet or set the zipfile comment. Returns the old comment.\n\nprint $zip->zipfileComment();\n$zip->zipfileComment( 'New Comment' );\n\neocdOffset()\nReturns the (unexpected) number of bytes between where the EOCD was\nfound and where it expected to be. This is normally 0, but would be\npositive if something (a virus, perhaps) had added bytes somewhere\nbefore the EOCD. Not used for writing zips, but might be\ninteresting if you read a zip in. Here is an example of how you can\ndiagnose this:\n\nmy $zip = Archive::Zip->new('somefile.zip');\nif ($zip->eocdOffset())\n{\nwarn \"A virus has added \", $zip->eocdOffset, \" bytes of garbage\\n\";\n}\n\nThe \"eocdOffset()\" is used to adjust the starting position of\nmember headers, if necessary.\n\nfileName()\nReturns the name of the file last read from. If nothing has been\nread yet, returns an empty string; if read from a file handle,\nreturns the handle in string form.\n\nZip Archive Member Operations\nVarious operations on a zip file modify members. When a member is\npassed as an argument, you can either use a reference to the member\nitself, or the name of a member. Of course, using the name requires\nthat names be unique within a zip (this is not enforced).\n\nremoveMember( $memberOrName )\nremoveMember( { memberOrZipName => $memberOrName } )\nRemove and return the given member, or match its name and remove\nit. Returns undef if member or name does not exist in this Zip. No-\nop if member does not belong to this zip.\n\nreplaceMember( $memberOrName, $newMember )\nreplaceMember( { memberOrZipName => $memberOrName, newMember =>\n$newMember } )\nRemove and return the given member, or match its name and remove\nit. Replace with new member. Returns undef if member or name does\nnot exist in this Zip, or if $newMember is undefined.\n\nIt is an (undiagnosed) error to provide a $newMember that is a\nmember of the zip being modified.\n\nmy $member1 = $zip->removeMember( 'xyz' );\nmy $member2 = $zip->replaceMember( 'abc', $member1 );\n# now, $member2 (named 'abc') is not in $zip,\n# and $member1 (named 'xyz') is, having taken $member2's place.\n\nextractMember( $memberOrName [, $extractedName ] )\nextractMember( { memberOrZipName => $memberOrName [, name =>\n$extractedName ] } )\nExtract the given member, or match its name and extract it.\nReturns undef if member does not exist in this Zip. If optional\nsecond arg is given, use it as the name of the extracted member.\nOtherwise, the internal filename of the member is used as the name\nof the extracted file or directory.  If you pass $extractedName, it\nshould be in the local file system's format.  If you do not pass\n$extractedName and the internal filename traverses a parent\ndirectory or a symbolic link, the extraction will be aborted with\n\"ACERROR\" for security reason.  All necessary directories will be\ncreated. Returns \"AZOK\" on success.\n\nextractMemberWithoutPaths( $memberOrName [, $extractedName ] )\nextractMemberWithoutPaths( { memberOrZipName => $memberOrName [, name\n=> $extractedName ] } )\nExtract the given member, or match its name and extract it.  Does\nnot use path information (extracts into the current directory).\nReturns undef if member does not exist in this Zip.  If optional\nsecond arg is given, use it as the name of the extracted member\n(its paths will be deleted too). Otherwise, the internal filename\nof the member (minus paths) is used as the name of the extracted\nfile or directory. Returns \"AZOK\" on success.  If you do not pass\n$extractedName and the internal filename is equalled to a local\nsymbolic link, the extraction will be aborted with \"ACERROR\" for\nsecurity reason.\n\naddMember( $member )\naddMember( { member => $member } )\nAppend a member (possibly from another zip file) to the zip file.\nReturns the new member. Generally, you will use addFile(),\naddDirectory(), addFileOrDirectory(), addString(), or read() to add\nmembers.\n\n# Move member named 'abc' to end of zip:\nmy $member = $zip->removeMember( 'abc' );\n$zip->addMember( $member );\n\nupdateMember( $memberOrName, $fileName )\nupdateMember( { memberOrZipName => $memberOrName, name => $fileName } )\nUpdate a single member from the file or directory named $fileName.\nReturns the (possibly added or updated) member, if any; \"undef\" on\nerrors.  The comparison is based on \"lastModTime()\" and (in the\ncase of a non-directory) the size of the file.\n\naddFile( $fileName [, $newName, $compressionLevel ] )\naddFile( { filename => $fileName [, zipName => $newName,\ncompressionLevel => $compressionLevel } ] )\nAppend a member whose data comes from an external file, returning\nthe member or undef. The member will have its file name set to the\nname of the external file, and its desiredCompressionMethod set to\nCOMPRESSIONDEFLATED. The file attributes and last modification\ntime will be set from the file.  If the name given does not\nrepresent a readable plain file or symbolic link, undef will be\nreturned. $fileName must be in the format required for the local\nfile system.  The optional $newName argument sets the internal file\nname to something different than the given $fileName. $newName, if\ngiven, must be in Zip name format (i.e. Unix).  The text mode bit\nwill be set if the contents appears to be text (as returned by the\n\"-T\" perl operator).\n\nNOTE that you should not (generally) use absolute path names in zip\nmember names, as this will cause problems with some zip tools as\nwell as introduce a security hole and make the zip harder to use.\n\naddDirectory( $directoryName [, $fileName ] )\naddDirectory( { directoryName => $directoryName [, zipName => $fileName\n] } )\nAppend a member created from the given directory name. The\ndirectory name does not have to name an existing directory.  If the\nnamed directory exists, the file modification time and permissions\nare set from the existing directory, otherwise they are set to now\nand permissive default permissions.  $directoryName must be in\nlocal file system format.  The optional second argument sets the\nname of the archive member (which defaults to $directoryName). If\ngiven, it must be in Zip (Unix) format.  Returns the new member.\n\naddFileOrDirectory( $name [, $newName, $compressionLevel ] )\naddFileOrDirectory( { name => $name [, zipName => $newName,\ncompressionLevel => $compressionLevel ] } )\nAppend a member from the file or directory named $name. If $newName\nis given, use it for the name of the new member.  Will add or\nremove trailing slashes from $newName as needed.  $name must be in\nlocal file system format.  The optional second argument sets the\nname of the archive member (which defaults to $name). If given, it\nmust be in Zip (Unix) format.\n\naddString( $stringOrStringRef, $name, [$compressionLevel] )\naddString( { string => $stringOrStringRef [, zipName => $name,\ncompressionLevel => $compressionLevel ] } )\nAppend a member created from the given string or string reference.\nThe name is given by the second argument.  Returns the new member.\nThe last modification time will be set to now, and the file\nattributes will be set to permissive defaults.\n\nmy $member = $zip->addString( 'This is a test', 'test.txt' );\n\ncontents( $memberOrMemberName [, $newContents ] )\ncontents( { memberOrZipName => $memberOrMemberName [, contents =>\n$newContents ] } )\nReturns the uncompressed data for a particular member, or undef.\n\nprint \"xyz.txt contains \" . $zip->contents( 'xyz.txt' );\n\nAlso can change the contents of a member:\n\n$zip->contents( 'xyz.txt', 'This is the new contents' );\n\nIf called expecting an array as the return value, it will include\nthe status as the second value in the array.\n\n($content, $status) = $zip->contents( 'xyz.txt');\n\nZip Archive I/O operations\nA Zip archive can be written to a file or file handle, or read from\none.\n\nwriteToFileNamed( $fileName )\nwriteToFileNamed( { fileName => $fileName } )\nWrite a zip archive to named file. Returns \"AZOK\" on success.\n\nmy $status = $zip->writeToFileNamed( 'xx.zip' );\ndie \"error somewhere\" if $status != AZOK;\n\nNote that if you use the same name as an existing zip file that you\nread in, you will clobber ZipFileMembers. So instead, write to a\ndifferent file name, then delete the original.  If you use the\n\"overwrite()\" or \"overwriteAs()\" methods, you can re-write the\noriginal zip in this way.  $fileName should be a valid file name on\nyour system.\n\nwriteToFileHandle( $fileHandle [, $seekable] )\nWrite a zip archive to a file handle. Return AZOK on success. The\noptional second arg tells whether or not to try to seek backwards\nto re-write headers. If not provided, it is set if the Perl \"-f\"\ntest returns true. This could fail on some operating systems,\nthough.\n\nmy $fh = IO::File->new( 'someFile.zip', 'w' );\nunless ( $zip->writeToFileHandle( $fh ) == AZOK ) {\n# error handling\n}\n\nIf you pass a file handle that is not seekable (like if you're\nwriting to a pipe or a socket), pass a false second argument:\n\nmy $fh = IO::File->new( '| cat > somefile.zip', 'w' );\n$zip->writeToFileHandle( $fh, 0 );   # fh is not seekable\n\nIf this method fails during the write of a member, that member and\nall following it will return false from \"wasWritten()\". See\nwriteCentralDirectory() for a way to deal with this.  If you want,\nyou can write data to the file handle before passing it to\nwriteToFileHandle(); this could be used (for instance) for making\nself-extracting archives. However, this only works reliably when\nwriting to a real file (as opposed to STDOUT or some other possible\nnon-file).\n\nSee examples/selfex.pl for how to write a self-extracting archive.\n\nwriteCentralDirectory( $fileHandle [, $offset ] )\nwriteCentralDirectory( { fileHandle => $fileHandle [, offset => $offset\n] } )\nWrites the central directory structure to the given file handle.\n\nReturns AZOK on success. If given an $offset, will seek to that\npoint before writing. This can be used for recovery in cases where\nwriteToFileHandle or writeToFileNamed returns an IO error because\nof running out of space on the destination file.\n\nYou can truncate the zip by seeking backwards and then writing the\ndirectory:\n\nmy $fh = IO::File->new( 'someFile.zip', 'w' );\nmy $retval = $zip->writeToFileHandle( $fh );\nif ( $retval == AZIOERROR ) {\nmy @unwritten = grep { not $->wasWritten() } $zip->members();\nif (@unwritten) {\n$zip->removeMember( $member ) foreach my $member ( @unwritten );\n$zip->writeCentralDirectory( $fh,\n$unwritten[0]->writeLocalHeaderRelativeOffset());\n}\n}\n\noverwriteAs( $newName )\noverwriteAs( { filename => $newName } )\nWrite the zip to the specified file, as safely as possible.  This\nis done by first writing to a temp file, then renaming the original\nif it exists, then renaming the temp file, then deleting the\nrenamed original if it exists. Returns AZOK if successful.\n\noverwrite()\nWrite back to the original zip file. See overwriteAs() above.  If\nthe zip was not ever read from a file, this generates an error.\n\nread( $fileName )\nread( { filename => $fileName } )\nRead zipfile headers from a zip file, appending new members.\nReturns \"AZOK\" or error code.\n\nmy $zipFile = Archive::Zip->new();\nmy $status = $zipFile->read( '/some/FileName.zip' );\n\nreadFromFileHandle( $fileHandle, $filename )\nreadFromFileHandle( { fileHandle => $fileHandle, filename => $filename\n} )\nRead zipfile headers from an already-opened file handle, appending\nnew members. Does not close the file handle.  Returns \"AZOK\" or\nerror code. Note that this requires a seekable file handle; reading\nfrom a stream is not yet supported, but using in-memory data is.\n\nmy $fh = IO::File->new( '/some/FileName.zip', 'r' );\nmy $zip1 = Archive::Zip->new();\nmy $status = $zip1->readFromFileHandle( $fh );\nmy $zip2 = Archive::Zip->new();\n$status = $zip2->readFromFileHandle( $fh );\n\nRead zip using in-memory data (recursable):\n\nopen my $fh, \"<\", \"archive.zip\" or die $!;\nmy $zipdata = do { local $.; <$fh> };\nmy $zip = Archive::Zip->new;\nopen my $dh, \"+<\", \\$zipdata;\n$zip->readFromFileHandle ($dh);\n\nZip Archive Tree operations\nThese used to be in Archive::Zip::Tree but got moved into Archive::Zip.\nThey enable operation on an entire tree of members or files.  A usage\nexample:\n\nuse Archive::Zip;\nmy $zip = Archive::Zip->new();\n\n# add all readable files and directories below . as xyz/*\n$zip->addTree( '.', 'xyz' );\n\n# add all readable plain files below /abc as def/*\n$zip->addTree( '/abc', 'def', sub { -f && -r } );\n\n# add all .c files below /tmp as stuff/*\n$zip->addTreeMatching( '/tmp', 'stuff', '\\.c$' );\n\n# add all .o files below /tmp as stuff/* if they aren't writable\n$zip->addTreeMatching( '/tmp', 'stuff', '\\.o$', sub { ! -w } );\n\n# add all .so files below /tmp that are smaller than 200 bytes as stuff/*\n$zip->addTreeMatching( '/tmp', 'stuff', '\\.o$', sub { -s < 200 } );\n\n# and write them into a file\n$zip->writeToFileNamed('xxx.zip');\n\n# now extract the same files into /tmpx\n$zip->extractTree( 'stuff', '/tmpx' );\n\n$zip->addTree( $root, $dest [, $pred, $compressionLevel ] ) -- Add tree\nof files to a zip\n$zip->addTree( { root => $root, zipName => $dest [, select => $pred,\ncompressionLevel => $compressionLevel ] )\n$root is the root of the tree of files and directories to be added.\nIt is a valid directory name on your system. $dest is the name for\nthe root in the zip file (undef or blank means to use relative\npathnames). It is a valid ZIP directory name (that is, it uses\nforward slashes (/) for separating directory components). $pred is\nan optional subroutine reference to select files: it is passed the\nname of the prospective file or directory using $, and if it\nreturns true, the file or directory will be included. The default\nis to add all readable files and directories. For instance, using\n\nmy $pred = sub { /\\.txt/ };\n$zip->addTree( '.', '', $pred );\n\nwill add all the .txt files in and below the current directory,\nusing relative names, and making the names identical in the\nzipfile:\n\noriginal name           zip member name\n./xyz                   xyz\n./a/                    a/\n./a/b                   a/b\n\nTo translate absolute to relative pathnames, just pass them in:\n$zip->addTree( '/c/d', 'a' );\n\noriginal name           zip member name\n/c/d/xyz                a/xyz\n/c/d/a/                 a/a/\n/c/d/a/b                a/a/b\n\nReturns AZOK on success. Note that this will not follow symbolic\nlinks to directories. Note also that this does not check for the\nvalidity of filenames.\n\nNote that you generally don't want to make zip archive member names\nabsolute.\n\n$zip->addTreeMatching( $root, $dest, $pattern [, $pred,\n$compressionLevel ] )\n$zip->addTreeMatching( { root => $root, zipName => $dest, pattern =>\n$pattern [, select => $pred, compressionLevel => $compressionLevel ] }\n)\n$root is the root of the tree of files and directories to be added\n$dest is the name for the root in the zip file (undef means to use\nrelative pathnames) $pattern is a (non-anchored) regular expression\nfor filenames to match $pred is an optional subroutine reference to\nselect files: it is passed the name of the prospective file or\ndirectory in $, and if it returns true, the file or directory will\nbe included.  The default is to add all readable files and\ndirectories. To add all files in and below the current directory\nwhose names end in \".pl\", and make them extract into a subdirectory\nnamed \"xyz\", do this:\n\n$zip->addTreeMatching( '.', 'xyz', '\\.pl$' )\n\nTo add all writable files in and below the directory named \"/abc\"\nwhose names end in \".pl\", and make them extract into a subdirectory\nnamed \"xyz\", do this:\n\n$zip->addTreeMatching( '/abc', 'xyz', '\\.pl$', sub { -w } )\n\nReturns AZOK on success. Note that this will not follow symbolic\nlinks to directories.\n\n$zip->updateTree( $root [, $dest , $pred , $mirror, $compressionLevel ]\n);\n$zip->updateTree( { root => $root [, zipName => $dest, select => $pred,\nmirror => $mirror, compressionLevel => $compressionLevel ] } );\nUpdate a zip file from a directory tree.\n\n\"updateTree()\" takes the same arguments as \"addTree()\", but first\nchecks to see whether the file or directory already exists in the\nzip file, and whether it has been changed.\n\nIf the fourth argument $mirror is true, then delete all my members\nif corresponding files were not found.\n\nReturns an error code or AZOK if all is well.\n\n$zip->extractTree( [ $root, $dest, $volume } ] )\n$zip->extractTree( [ { root => $root, zipName => $dest, volume =>\n$volume } ] )\nIf you don't give any arguments at all, will extract all the files\nin the zip with their original names.\n\nIf you supply one argument for $root, \"extractTree\" will extract\nall the members whose names start with $root into the current\ndirectory, stripping off $root first.  $root is in Zip (Unix)\nformat.  For instance,\n\n$zip->extractTree( 'a' );\n\nwhen applied to a zip containing the files: a/x a/b/c ax/d/e d/e\nwill extract:\n\na/x as ./x\n\na/b/c as ./b/c\n\nIf you give two arguments, \"extractTree\" extracts all the members\nwhose names start with $root. It will translate $root into $dest to\nconstruct the destination file name.  $root and $dest are in Zip\n(Unix) format.  For instance,\n\n$zip->extractTree( 'a', 'd/e' );\n\nwhen applied to a zip containing the files: a/x a/b/c ax/d/e d/e\nwill extract:\n\na/x to d/e/x\n\na/b/c to d/e/b/c and ignore ax/d/e and d/e\n\nIf you give three arguments, \"extractTree\" extracts all the members\nwhose names start with $root. It will translate $root into $dest to\nconstruct the destination file name, and then it will convert to\nlocal file system format, using $volume as the name of the\ndestination volume.\n\n$root and $dest are in Zip (Unix) format.\n\n$volume is in local file system format.\n\nFor instance, under Windows,\n\n$zip->extractTree( 'a', 'd/e', 'f:' );\n\nwhen applied to a zip containing the files: a/x a/b/c ax/d/e d/e\nwill extract:\n\na/x to f:d/e/x\n\na/b/c to f:d/e/b/c and ignore ax/d/e and d/e\n\nIf you want absolute paths (the prior example used paths relative\nto the current directory on the destination volume, you can specify\nthese in $dest:\n\n$zip->extractTree( 'a', '/d/e', 'f:' );\n\nwhen applied to a zip containing the files: a/x a/b/c ax/d/e d/e\nwill extract:\n\na/x to f:\\d\\e\\x\n\na/b/c to f:\\d\\e\\b\\c and ignore ax/d/e and d/e\n\nIf the path to the extracted file traverses a parent directory or a\nsymbolic link, the extraction will be aborted with \"ACERROR\" for\nsecurity reason.  Returns an error code or AZOK if everything\nworked OK.\n",
            "subsections": []
        },
        "Archive::Zip Global Variables": {
            "content": "$Archive::Zip::UNICODE\nThis variable governs how Unicode file and directory names are\nadded to or extracted from an archive. If set, file and directory\nnames are considered to be UTF-8 encoded. This is EXPERIMENTAL AND\nBUGGY (there are some edge cases on Win32). Please report problems.\n\n{\nlocal $Archive::Zip::UNICODE = 1;\n$zip->addFile('Deja vu.txt');\n}\n",
            "subsections": []
        },
        "MEMBER OPERATIONS": {
            "content": "Member Class Methods\nSeveral constructors allow you to construct members without adding them\nto a zip archive. These work the same as the addFile(), addDirectory(),\nand addString() zip instance methods described above, but they don't\nadd the new members to a zip.\n\nArchive::Zip::Member->newFromString( $stringOrStringRef [, $fileName ]\n)\nArchive::Zip::Member->newFromString( { string => $stringOrStringRef [,\nzipName => $fileName ] )\nConstruct a new member from the given string. Returns undef on\nerror.\n\nmy $member = Archive::Zip::Member->newFromString( 'This is a test' );\nmy $member = Archive::Zip::Member->newFromString( 'This is a test', 'test.txt' );\nmy $member = Archive::Zip::Member->newFromString( { string => 'This is a test', zipName => 'test.txt' } );\n\nnewFromFile( $fileName [, $zipName ] )\nnewFromFile( { filename => $fileName [, zipName => $zipName ] } )\nConstruct a new member from the given file. Returns undef on error.\n\nmy $member = Archive::Zip::Member->newFromFile( 'xyz.txt' );\n\nnewDirectoryNamed( $directoryName [, $zipname ] )\nnewDirectoryNamed( { directoryName => $directoryName [, zipName =>\n$zipname ] } )\nConstruct a new member from the given directory.  $directoryName\nmust be a valid name on your file system; it does not have to\nexist.\n\nIf given, $zipname will be the name of the zip member; it must be a\nvalid Zip (Unix) name. If not given, it will be converted from\n$directoryName.\n\nReturns undef on error.\n\nmy $member = Archive::Zip::Member->newDirectoryNamed( 'CVS/' );\n\nMember Simple Accessors\nThese methods get (and/or set) member attribute values.\n\nThe zip64 format requires parts of the member data to be stored in the\nso-called extra fields.  You cannot get nor set this zip64 data through\nthe extra field accessors described in this section.  In fact, the low-\nlevel member methods ensure that the zip64 data in the extra fields is\nhandled completely transparently and invisibly to the user when members\nare read or written.\n\nzip64()\nReturns whether the previous read or write of the member has been\ndone in zip64 format.\n\ndesiredZip64Mode()\nGets or sets whether the member's headers should be written in\nzip64 format: As needed (ZIP64ASNEEDED), the default, or always\n(ZIP64HEADERS).\n\nversionMadeBy()\nGets the field from the member header.\n\nfileAttributeFormat( [ $format ] )\nfileAttributeFormat( [ { format => $format ] } )\nGets or sets the field from the member header. These are \"FA*\"\nvalues.\n\nversionNeededToExtract()\nGets the field from the member header.\n\nbitFlag()\nGets the general purpose bit field from the member header.  This is\nwhere the \"GPBF*\" bits live.\n\ncompressionMethod()\nReturns the member compression method. This is the method that is\ncurrently being used to compress the member data.  This will be\nCOMPRESSIONSTORED for added string or file members, or any of the\n\"COMPRESSION*\" values for members from a zip file. However, this\nmodule can only handle members whose data is in COMPRESSIONSTORED\nor COMPRESSIONDEFLATED format.\n\ndesiredCompressionMethod( [ $method ] )\ndesiredCompressionMethod( [ { compressionMethod => $method } ] )\nGet or set the member's \"desiredCompressionMethod\". This is the\ncompression method that will be used when the member is written.\nReturns prior desiredCompressionMethod. Only COMPRESSIONDEFLATED\nor COMPRESSIONSTORED are valid arguments. Changing to\nCOMPRESSIONSTORED will change the member desiredCompressionLevel\nto 0; changing to COMPRESSIONDEFLATED will change the member\ndesiredCompressionLevel to COMPRESSIONLEVELDEFAULT.\n\ndesiredCompressionLevel( [ $level ] )\ndesiredCompressionLevel( [ { compressionLevel => $level } ] )\nGet or set the member's desiredCompressionLevel This is the method\nthat will be used to write. Returns prior desiredCompressionLevel.\nValid arguments are 0 through 9, COMPRESSIONLEVELNONE,\nCOMPRESSIONLEVELDEFAULT, COMPRESSIONLEVELBESTCOMPRESSION, and\nCOMPRESSIONLEVELFASTEST. 0 or COMPRESSIONLEVELNONE will change\nthe desiredCompressionMethod to COMPRESSIONSTORED.  All other\narguments will change the desiredCompressionMethod to\nCOMPRESSIONDEFLATED.\n\nexternalFileName()\nReturn the member's external file name, if any, or undef.\n\nfileName()\nGet or set the member's internal filename. Returns the (possibly\nnew) filename. Names will have backslashes converted to forward\nslashes, and will have multiple consecutive slashes converted to\nsingle ones.\n\nlastModFileDateTime()\nReturn the member's last modification date/time stamp in MS-DOS\nformat.\n\nlastModTime()\nReturn the member's last modification date/time stamp, converted to\nunix localtime format.\n\nprint \"Mod Time: \" . scalar( localtime( $member->lastModTime() ) );\n\nsetLastModFileDateTimeFromUnix()\nSet the member's lastModFileDateTime from the given unix time.\n\n$member->setLastModFileDateTimeFromUnix( time() );\n\ninternalFileAttributes()\nReturn the internal file attributes field from the zip header. This\nis only set for members read from a zip file.\n\nexternalFileAttributes()\nReturn member attributes as read from the ZIP file. Note that these\nare NOT UNIX!\n\nunixFileAttributes( [ $newAttributes ] )\nunixFileAttributes( [ { attributes => $newAttributes } ] )\nGet or set the member's file attributes using UNIX file attributes.\nReturns old attributes.\n\nmy $oldAttribs = $member->unixFileAttributes( 0666 );\n\nNote that the return value has more than just the file permissions,\nso you will have to mask off the lowest bits for comparisons.\n\nlocalExtraField( [ $newField ] )\nlocalExtraField( [ { field => $newField } ] )\nGets or sets the extra field that was read from the local header.\nThe extra field must be in the proper format.  If it is not or if\nthe new field contains data related to the zip64 format, this\nmethod does not modify the extra field and returns AZFORMATERROR,\notherwise it returns AZOK.\n\ncdExtraField( [ $newField ] )\ncdExtraField( [ { field => $newField } ] )\nGets or sets the extra field that was read from the central\ndirectory header. The extra field must be in the proper format.  If\nit is not or if the new field contains data related to the zip64\nformat, this method does not modify the extra field and returns\nAZFORMATERROR, otherwise it returns AZOK.\n\nextraFields()\nReturn both local and CD extra fields, concatenated.\n\nfileComment( [ $newComment ] )\nfileComment( [ { comment => $newComment } ] )\nGet or set the member's file comment.\n\nhasDataDescriptor()\nGet or set the data descriptor flag. If this is set, the local\nheader will not necessarily have the correct data sizes. Instead, a\nsmall structure will be stored at the end of the member data with\nthese values. This should be transparent in normal operation.\n\ncrc32()\nReturn the CRC-32 value for this member. This will not be set for\nmembers that were constructed from strings or external files until\nafter the member has been written.\n\ncrc32String()\nReturn the CRC-32 value for this member as an 8 character printable\nhex string. This will not be set for members that were constructed\nfrom strings or external files until after the member has been\nwritten.\n\ncompressedSize()\nReturn the compressed size for this member. This will not be set\nfor members that were constructed from strings or external files\nuntil after the member has been written.\n\nuncompressedSize()\nReturn the uncompressed size for this member.\n\npassword( [ $password ] )\nReturns the password for this member to be used on decryption.  If\n$password is given, it will set the password for the decryption.\n\nisEncrypted()\nReturn true if this member is encrypted. The Archive::Zip module\ndoes not currently support creation of encrypted members.\nDecryption works more or less like this:\n\nmy $zip = Archive::Zip->new;\n$zip->read (\"encrypted.zip\");\nfor my $m (map { $zip->memberNamed ($) } $zip->memberNames) {\n$m->password (\"secret\");\n$m->contents;  # is \"\" when password was wrong\n\nThat shows that the password has to be set per member, and not per\narchive. This might change in the future.\n\nisTextFile( [ $flag ] )\nisTextFile( [ { flag => $flag } ] )\nReturns true if I am a text file. Also can set the status if given\nan argument (then returns old state). Note that this module does\nnot currently do anything with this flag upon extraction or\nstorage. That is, bytes are stored in native format whether or not\nthey came from a text file.\n\nisBinaryFile()\nReturns true if I am a binary file. Also can set the status if\ngiven an argument (then returns old state). Note that this module\ndoes not currently do anything with this flag upon extraction or\nstorage. That is, bytes are stored in native format whether or not\nthey came from a text file.\n\nextractToFileNamed( $fileName )\nextractToFileNamed( { name => $fileName } )\nExtract me to a file with the given name. The file will be created\nwith default modes. Directories will be created as needed.  The\n$fileName argument should be a valid file name on your file system.\nReturns AZOK on success.\n\nisDirectory()\nReturns true if I am a directory.\n\nisSymbolicLink()\nReturns true if I am a symbolic link.\n\nwriteLocalHeaderRelativeOffset()\nReturns the file offset in bytes the last time I was written.\n\nwasWritten()\nReturns true if I was successfully written. Reset at the beginning\nof a write attempt.\n\nLow-level member data reading\nIt is possible to use lower-level routines to access member data\nstreams, rather than the extract* methods and contents(). For instance,\nhere is how to print the uncompressed contents of a member in chunks\nusing these methods:\n\nmy ( $member, $status, $bufferRef );\n$member = $zip->memberNamed( 'xyz.txt' );\n$member->desiredCompressionMethod( COMPRESSIONSTORED );\n$status = $member->rewindData();\ndie \"error $status\" unless $status == AZOK;\nwhile ( ! $member->readIsDone() )\n{\n( $bufferRef, $status ) = $member->readChunk();\ndie \"error $status\"\nif $status != AZOK && $status != AZSTREAMEND;\n# do something with $bufferRef:\nprint $$bufferRef;\n}\n$member->endRead();\n\nreadChunk( [ $chunkSize ] )\nreadChunk( [ { chunkSize => $chunkSize } ] )\nThis reads the next chunk of given size from the member's data\nstream and compresses or uncompresses it as necessary, returning a\nreference to the bytes read and a status. If size argument is not\ngiven, defaults to global set by Archive::Zip::setChunkSize. Status\nis AZOK on success until the last chunk, where it returns\nAZSTREAMEND. Returns \"( \\$bytes, $status)\".\n\nmy ( $outRef, $status ) = $self->readChunk();\nprint $$outRef if $status != AZOK && $status != AZSTREAMEND;\n\nrewindData()\nRewind data and set up for reading data streams or writing zip\nfiles. Can take options for \"inflateInit()\" or \"deflateInit()\", but\nthis is not likely to be necessary.  Subclass overrides should call\nthis method. Returns \"AZOK\" on success.\n\nendRead()\nReset the read variables and free the inflater or deflater.  Must\nbe called to close files, etc. Returns AZOK on success.\n\nreadIsDone()\nReturn true if the read has run out of data or encountered an\nerror.\n\ncontents()\nReturn the entire uncompressed member data or undef in scalar\ncontext. When called in array context, returns \"( $string, $status\n)\"; status will be AZOK on success:\n\nmy $string = $member->contents();\n# or\nmy ( $string, $status ) = $member->contents();\ndie \"error $status\" unless $status == AZOK;\n\nCan also be used to set the contents of a member (this may change\nthe class of the member):\n\n$member->contents( \"this is my new contents\" );\n\nextractToFileHandle( $fh )\nextractToFileHandle( { fileHandle => $fh } )\nExtract (and uncompress, if necessary) the member's contents to the\ngiven file handle. Return AZOK on success.\n\nFor members representing symbolic links, pass the name of the\nsymbolic link as file handle. Ensure that all directories in the\npath to the symbolic link already exist.\n",
            "subsections": []
        },
        "Archive::Zip::FileMember methods": {
            "content": "The Archive::Zip::FileMember class extends Archive::Zip::Member. It is\nthe base class for both ZipFileMember and NewFileMember classes. This\nclass adds an \"externalFileName\" and an \"fh\" member to keep track of\nthe external file.\n\nexternalFileName()\nReturn the member's external filename.\n\nfh()\nReturn the member's read file handle. Automatically opens file if\nnecessary.\n",
            "subsections": []
        },
        "Archive::Zip::ZipFileMember methods": {
            "content": "The Archive::Zip::ZipFileMember class represents members that have been\nread from external zip files.\n\ndiskNumberStart()\nReturns the disk number that the member's local header resides in.\nShould be 0.\n\nlocalHeaderRelativeOffset()\nReturns the offset into the zip file where the member's local\nheader is.\n\ndataOffset()\nReturns the offset from the beginning of the zip file to the\nmember's data.\n",
            "subsections": []
        },
        "REQUIRED MODULES": {
            "content": "Archive::Zip requires several other modules:\n\nCarp\n\nCompress::Raw::Zlib\n\nCwd\n\nFile::Basename\n\nFile::Copy\n\nFile::Find\n\nFile::Path\n\nFile::Spec\n\nIO::File\n\nIO::Seekable\n\nTime::Local\n",
            "subsections": []
        },
        "BUGS AND CAVEATS": {
            "content": "When not to use Archive::Zip\nIf you are just going to be extracting zips (and/or other archives) you\nare recommended to look at using Archive::Extract instead, as it is\nmuch easier to use and factors out archive-specific functionality.\n\nZip64 Format Support\nSince version 1.66 Archive::Zip supports the so-called zip64 format,\nwhich overcomes various limitations in the original zip file format.\nOn some Perl interpreters, however, even version 1.66 and newer of\nArchive::Zip cannot support the zip64 format.  Among these are all Perl\ninterpreters that lack 64-bit support and those older than version\n5.10.0.\n\nConstant \"ZIP64SUPPORTED\", exported with tag :CONSTANTS, equals true\nif Archive::Zip on the current Perl interpreter supports the zip64\nformat.  If it does not and you try to read or write an archive in\nzip64 format, anyway, Archive::Zip returns an error \"AZERROR\" and\nreports an error message along the lines of \"zip64 format not supported\non this Perl interpreter\".\n\n\"versionMadeBy\" and \"versionNeededToExtract\"\nThe zip64 format and the zip file format in general specify what values\nto use for the \"versionMadeBy\" and \"versionNeededToExtract\" fields in\nthe local file header, central directory file header, and zip64 EOCD\nrecord.  In practice however, these fields seem to be more or less\nrandomly used by various archiver implementations.\n\nTo achieve a compromise between backward compatibility and (whatever)\nstandard compliance, Archive::Zip handles them as follows:\n\no   For field \"versionMadeBy\", Archive::Zip uses default value 20 (45\nfor the zip64 EOCD record) or any previously read value. It never\nchanges that value when writing a header, even if it is written in\nzip64 format, or when writing the zip64 EOCD record.\n\no   Likewise for field \"versionNeededToExtract\", but here Archive::Zip\nforces a minimum value of 45 when writing a header in zip64 format\nor the zip64 EOCD record.\n\no   Finally, Archive::Zip never depends on the values of these fields\nin any way when reading an archive from a file or file handle.\n\nTry to avoid IO::Scalar\nOne of the most common ways to use Archive::Zip is to generate Zip\nfiles in-memory. Most people use IO::Scalar for this purpose.\n\nUnfortunately, as of 1.11 this module no longer works with IO::Scalar\nas it incorrectly implements seeking.\n\nAnybody using IO::Scalar should consider porting to IO::String, which\nis smaller, lighter, and is implemented to be perfectly compatible with\nregular seekable filehandles.\n\nSupport for IO::Scalar most likely will not be restored in the future,\nas IO::Scalar itself cannot change the way it is implemented due to\nback-compatibility issues.\n\nWrong password for encrypted members\nWhen an encrypted member is read using the wrong password, you\ncurrently have to re-read the entire archive to try again with the\ncorrect password.\n",
            "subsections": []
        },
        "TO DO": {
            "content": "* auto-choosing storing vs compression\n\n* extra field hooks (see notes.txt)\n\n* check for duplicates on addition/renaming?\n\n* Text file extraction (line end translation)\n\n* Reading zip files from non-seekable inputs\n(Perhaps by proxying through IO::String?)\n\n* separate unused constants into separate module\n\n* cookbook style docs\n\n* Handle tainted paths correctly\n\n* Work on better compatibility with other IO:: modules\n\n* Support encryption\n\n* More user-friendly decryption\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs should be reported on GitHub\n\n<https://github.com/redhotpenguin/perl-Archive-Zip/issues>\n\nFor other issues contact the maintainer.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Currently maintained by Fred Moyer <fred@redhotpenguin.com>\n\nPreviously maintained by Adam Kennedy <adamk@cpan.org>\n\nPreviously maintained by Steve Peters <steve@fisharerojo.org>.\n\nFile attributes code by Maurice Aubrey <maurice@lovelyfilth.com>.\n\nOriginally by Ned Konz <nedkonz@cpan.org>.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Some parts copyright 2006 - 2012 Adam Kennedy.\n\nSome parts copyright 2005 Steve Peters.\n\nOriginal work copyright 2000 - 2004 Ned Konz.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Look at Archive::Zip::MemberRead which is a wrapper that allows one to\nread Zip archive members as if they were files.\n\nCompress::Raw::Zlib, Archive::Tar, Archive::Extract\n\nperl v5.30.0                      2020-03-14                 Archive::Zip(3pm)",
            "subsections": []
        }
    },
    "summary": "Archive::Zip - Provide an interface to ZIP archive files.",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "Zip",
            "section": "3pm",
            "url": "https://www.chedong.com/phpMan.php/man/Zip/3pm/json"
        }
    ]
}