Server IP : 103.119.228.120 / Your IP : 3.148.108.201 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Archive::Zip::FAQ 3" .TH Archive::Zip::FAQ 3 "2015-12-03" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Archive::Zip::FAQ \- Answers to a few frequently asked questions about Archive::Zip .SH "DESCRIPTION" .IX Header "DESCRIPTION" It seems that I keep answering the same questions over and over again. I assume that this is because my documentation is deficient, rather than that people don't read the documentation. .PP So this \s-1FAQ\s0 is an attempt to cut down on the number of personal answers I have to give. At least I can now say "You \fIdid\fR read the \s-1FAQ,\s0 right?". .PP The questions are not in any particular order. The answers assume the current version of Archive::Zip; some of the answers depend on newly added/fixed functionality. .SH "Install problems on RedHat 8 or 9 with Perl 5.8.0" .IX Header "Install problems on RedHat 8 or 9 with Perl 5.8.0" \&\fBQ:\fR Archive::Zip won't install on my RedHat 9 system! It's broke! .PP \&\fBA:\fR This has become something of a \s-1FAQ.\s0 Basically, RedHat broke some versions of Perl by setting \s-1LANG\s0 to \s-1UTF8.\s0 They apparently have a fixed version out as an update. .PP You might try running \s-1CPAN\s0 or creating your Makefile after exporting the \s-1LANG\s0 environment variable as .PP \&\f(CW\*(C`LANG=C\*(C'\fR .PP <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=87682> .SH "Why is my zip file so big?" .IX Header "Why is my zip file so big?" \&\fBQ:\fR My zip file is actually bigger than what I stored in it! Why? .PP \&\fBA:\fR Some things to make sure of: .IP "Make sure that you are requesting \s-1COMPRESSION_DEFLATED\s0 if you are storing strings." 4 .IX Item "Make sure that you are requesting COMPRESSION_DEFLATED if you are storing strings." \&\f(CW$member\fR\->desiredCompressionMethod( \s-1COMPRESSION_DEFLATED \s0); .IP "Don't make lots of little files if you can help it." 4 .IX Item "Don't make lots of little files if you can help it." Since zip computes the compression tables for each member, small members without much entropy won't compress well. Instead, if you've got lots of repeated strings in your data, try to combine them into one big member. .IP "Make sure that you are requesting \s-1COMPRESSION_STORED\s0 if you are storing things that are already compressed." 4 .IX Item "Make sure that you are requesting COMPRESSION_STORED if you are storing things that are already compressed." If you're storing a .zip, .jpg, .mp3, or other compressed file in a zip, then don't compress them again. They'll get bigger. .SH "Sample code?" .IX Header "Sample code?" \&\fBQ:\fR Can you send me code to do (whatever)? .PP \&\fBA:\fR Have you looked in the \f(CW\*(C`examples/\*(C'\fR directory yet? It contains: .IP "examples/calcSizes.pl \*(-- How to find out how big a Zip file will be before writing it" 4 .IX Item "examples/calcSizes.pl How to find out how big a Zip file will be before writing it" .PD 0 .IP "examples/copy.pl \*(-- Copies one Zip file to another" 4 .IX Item "examples/copy.pl Copies one Zip file to another" .IP "examples/extract.pl \*(-- extract file(s) from a Zip" 4 .IX Item "examples/extract.pl extract file(s) from a Zip" .IP "examples/mailZip.pl \*(-- make and mail a zip file" 4 .IX Item "examples/mailZip.pl make and mail a zip file" .IP "examples/mfh.pl \*(-- demo for use of MockFileHandle" 4 .IX Item "examples/mfh.pl demo for use of MockFileHandle" .IP "examples/readScalar.pl \*(-- shows how to use IO::Scalar as the source of a Zip read" 4 .IX Item "examples/readScalar.pl shows how to use IO::Scalar as the source of a Zip read" .IP "examples/selfex.pl \*(-- a brief example of a self-extracting Zip" 4 .IX Item "examples/selfex.pl a brief example of a self-extracting Zip" .IP "examples/unzipAll.pl \*(-- uses Archive::Zip::Tree to unzip an entire Zip" 4 .IX Item "examples/unzipAll.pl uses Archive::Zip::Tree to unzip an entire Zip" .IP "examples/updateZip.pl \*(-- shows how to read/modify/write a Zip" 4 .IX Item "examples/updateZip.pl shows how to read/modify/write a Zip" .IP "examples/updateTree.pl \*(-- shows how to update a Zip in place" 4 .IX Item "examples/updateTree.pl shows how to update a Zip in place" .IP "examples/writeScalar.pl \*(-- shows how to use IO::Scalar as the destination of a Zip write" 4 .IX Item "examples/writeScalar.pl shows how to use IO::Scalar as the destination of a Zip write" .IP "examples/writeScalar2.pl \*(-- shows how to use IO::String as the destination of a Zip write" 4 .IX Item "examples/writeScalar2.pl shows how to use IO::String as the destination of a Zip write" .IP "examples/zip.pl \*(-- Constructs a Zip file" 4 .IX Item "examples/zip.pl Constructs a Zip file" .IP "examples/zipcheck.pl \*(-- One way to check a Zip file for validity" 4 .IX Item "examples/zipcheck.pl One way to check a Zip file for validity" .IP "examples/zipinfo.pl \*(-- Prints out information about a Zip archive file" 4 .IX Item "examples/zipinfo.pl Prints out information about a Zip archive file" .IP "examples/zipGrep.pl \*(-- Searches for text in Zip files" 4 .IX Item "examples/zipGrep.pl Searches for text in Zip files" .IP "examples/ziptest.pl \*(-- Lists a Zip file and checks member CRCs" 4 .IX Item "examples/ziptest.pl Lists a Zip file and checks member CRCs" .IP "examples/ziprecent.pl \*(-- Puts recent files into a zipfile" 4 .IX Item "examples/ziprecent.pl Puts recent files into a zipfile" .IP "examples/ziptest.pl \*(-- Another way to check a Zip file for validity" 4 .IX Item "examples/ziptest.pl Another way to check a Zip file for validity" .PD .SH "Can't Read/modify/write same Zip file" .IX Header "Can't Read/modify/write same Zip file" \&\fBQ:\fR Why can't I open a Zip file, add a member, and write it back? I get an error message when I try. .PP \&\fBA:\fR Because Archive::Zip doesn't (and can't, generally) read file contents into memory, the original Zip file is required to stay around until the writing of the new file is completed. .PP The best way to do this is to write the Zip to a temporary file and then rename the temporary file to have the old name (possibly after deleting the old one). .PP Archive::Zip v1.02 added the archive methods \f(CW\*(C`overwrite()\*(C'\fR and \&\f(CW\*(C`overwriteAs()\*(C'\fR to do this simply and carefully. .PP See \f(CW\*(C`examples/updateZip.pl\*(C'\fR for an example of this technique. .SH "File creation time not set" .IX Header "File creation time not set" \&\fBQ:\fR Upon extracting files, I see that their modification (and access) times are set to the time in the Zip archive. However, their creation time is not set to the same time. Why? .PP \&\fBA:\fR Mostly because Perl doesn't give cross-platform access to \fIcreation time\fR. Indeed, many systems (like Unix) don't support such a concept. However, if yours does, you can easily set it. Get the modification time from the member using \f(CW\*(C`lastModTime()\*(C'\fR. .SH "Can't use Archive::Zip on gzip files" .IX Header "Can't use Archive::Zip on gzip files" \&\fBQ:\fR Can I use Archive::Zip to extract Unix gzip files? .PP \&\fBA:\fR No. .PP There is a distinction between Unix gzip files, and Zip archives that also can use the gzip compression. .PP Depending on the format of the gzip file, you can use Compress::Raw::Zlib, or Archive::Tar to decompress it (and de-archive it in the case of Tar files). .PP You can unzip PKZIP/WinZip/etc/ archives using Archive::Zip (that's what it's for) as long as any compressed members are compressed using Deflate compression. .SH "Add a directory/tree to a Zip" .IX Header "Add a directory/tree to a Zip" \&\fBQ:\fR How can I add a directory (or tree) full of files to a Zip? .PP \&\fBA:\fR You can use the Archive::Zip::addTree*() methods: .PP .Vb 10 \& use Archive::Zip; \& my $zip = Archive::Zip\->new(); \& # add all readable files and directories below . as xyz/* \& $zip\->addTree( \*(Aq.\*(Aq, \*(Aqxyz\*(Aq ); \& # add all readable plain files below /abc as def/* \& $zip\->addTree( \*(Aq/abc\*(Aq, \*(Aqdef\*(Aq, sub { \-f && \-r } ); \& # add all .c files below /tmp as stuff/* \& $zip\->addTreeMatching( \*(Aq/tmp\*(Aq, \*(Aqstuff\*(Aq, \*(Aq\e.c$\*(Aq ); \& # add all .o files below /tmp as stuff/* if they aren\*(Aqt writable \& $zip\->addTreeMatching( \*(Aq/tmp\*(Aq, \*(Aqstuff\*(Aq, \*(Aq\e.o$\*(Aq, sub { ! \-w } ); \& # add all .so files below /tmp that are smaller than 200 bytes as stuff/* \& $zip\->addTreeMatching( \*(Aq/tmp\*(Aq, \*(Aqstuff\*(Aq, \*(Aq\e.o$\*(Aq, sub { \-s < 200 } ); \& # and write them into a file \& $zip\->writeToFileNamed(\*(Aqxxx.zip\*(Aq); .Ve .SH "Extract a directory/tree" .IX Header "Extract a directory/tree" \&\fBQ:\fR How can I extract some (or all) files from a Zip into a different directory? .PP \&\fBA:\fR You can use the \fIArchive::Zip::extractTree()\fR method: ??? || .PP .Vb 2 \& # now extract the same files into /tmpx \& $zip\->extractTree( \*(Aqstuff\*(Aq, \*(Aq/tmpx\*(Aq ); .Ve .SH "Update a directory/tree" .IX Header "Update a directory/tree" \&\fBQ:\fR How can I update a Zip from a directory tree, adding or replacing only the newer files? .PP \&\fBA:\fR You can use the \fIArchive::Zip::updateTree()\fR method that was added in version 1.09. .SH "Zip times might be off by 1 second" .IX Header "Zip times might be off by 1 second" \&\fBQ:\fR It bothers me greatly that my file times are wrong by one second about half the time. Why don't you do something about it? .PP \&\fBA:\fR Get over it. This is a result of the Zip format storing times in \s-1DOS\s0 format, which has a resolution of only two seconds. .SH "Zip times don't include time zone information" .IX Header "Zip times don't include time zone information" \&\fBQ:\fR My file times don't respect time zones. What gives? .PP \&\fBA:\fR If this is important to you, please submit patches to read the various Extra Fields that encode times with time zones. I'm just using the \s-1DOS\s0 Date/Time, which doesn't have a time zone. .SH "How do I make a self-extracting Zip" .IX Header "How do I make a self-extracting Zip" \&\fBQ:\fR I want to make a self-extracting Zip file. Can I do this? .PP \&\fBA:\fR Yes. You can write a self-extracting archive stub (that is, a version of unzip) to the output filehandle that you pass to \fIwriteToFileHandle()\fR. See examples/selfex.pl for how to write a self-extracting archive. .PP However, you should understand that this will only work on one kind of platform (the one for which the stub was compiled). .SH "How can I deal with Zips with prepended garbage (i.e. from Sircam)" .IX Header "How can I deal with Zips with prepended garbage (i.e. from Sircam)" \&\fBQ:\fR How can I tell if a Zip has been damaged by adding garbage to the beginning or inside the file? .PP \&\fBA:\fR I added code for this for the Amavis virus scanner. You can query archives for their 'eocdOffset' property, which should be 0: .PP .Vb 2 \& if ($zip\->eocdOffset > 0) \& { warn($zip\->eocdOffset . " bytes of garbage at beginning or within Zip") } .Ve .PP When members are extracted, this offset will be used to adjust the start of the member if necessary. .SH "Can't extract Shrunk files" .IX Header "Can't extract Shrunk files" \&\fBQ:\fR I'm trying to extract a file out of a Zip produced by \s-1PKZIP,\s0 and keep getting this error message: .PP .Vb 1 \& error: Unsupported compression combination: read 6, write 0 .Ve .PP \&\fBA:\fR You can't uncompress this archive member. Archive::Zip only supports uncompressed members, and compressed members that are compressed using the compression supported by Compress::Raw::Zlib. That means only Deflated and Stored members. .PP Your file is compressed using the Shrink format, which is not supported by Compress::Raw::Zlib. .PP You could, perhaps, use a command-line UnZip program (like the Info-Zip one) to extract this. .SH "Can't do decryption" .IX Header "Can't do decryption" \&\fBQ:\fR How do I decrypt encrypted Zip members? .PP \&\fBA:\fR With some other program or library. Archive::Zip doesn't support decryption, and probably never will (unless \fIyou\fR write it). .SH "How to test file integrity?" .IX Header "How to test file integrity?" \&\fBQ:\fR How can Archive::Zip can test the validity of a Zip file? .PP \&\fBA:\fR If you try to decompress the file, the gzip streams will report errors if you have garbage. Most of the time. .PP If you try to open the file and a central directory structure can't be found, an error will be reported. .PP When a file is being read, if we can't find a proper \s-1PK..\s0 signature in the right places we report a format error. .PP If there is added garbage at the beginning of a Zip file (as inserted by some viruses), you can find out about it, but Archive::Zip will ignore it, and you can still use the archive. When it gets written back out the added stuff will be gone. .PP There are two ready-to-use utilities in the examples directory that can be used to test file integrity, or that you can use as examples for your own code: .IP "examples/zipcheck.pl shows how to use an attempted extraction to test a file." 4 .IX Item "examples/zipcheck.pl shows how to use an attempted extraction to test a file." .PD 0 .IP "examples/ziptest.pl shows how to test CRCs in a file." 4 .IX Item "examples/ziptest.pl shows how to test CRCs in a file." .PD .SH "Duplicate files in Zip?" .IX Header "Duplicate files in Zip?" \&\fBQ:\fR Archive::Zip let me put the same file in my Zip twice! Why don't you prevent this? .PP \&\fBA:\fR As far as I can tell, this is not disallowed by the Zip spec. If you think it's a bad idea, check for it yourself: .PP .Vb 1 \& $zip\->addFile($someFile, $someName) unless $zip\->memberNamed($someName); .Ve .PP I can even imagine cases where this might be useful (for instance, multiple versions of files). .SH "File ownership/permissions/ACLS/etc" .IX Header "File ownership/permissions/ACLS/etc" \&\fBQ:\fR Why doesn't Archive::Zip deal with file ownership, ACLs, etc.? .PP \&\fBA:\fR There is no standard way to represent these in the Zip file format. If you want to send me code to properly handle the various extra fields that have been used to represent these through the years, I'll look at it. .SH "I can't compile but ActiveState only has an old version of Archive::Zip" .IX Header "I can't compile but ActiveState only has an old version of Archive::Zip" \&\fBQ:\fR I've only installed modules using ActiveState's \s-1PPM\s0 program and repository. But they have a much older version of Archive::Zip than is in \s-1CPAN.\s0 Will you send me a newer \s-1PPM\s0? .PP \&\fBA:\fR Probably not, unless I get lots of extra time. But there's no reason you can't install the version from \s-1CPAN.\s0 Archive::Zip is pure Perl, so all you need is \&\s-1NMAKE,\s0 which you can get for free from Microsoft (see the \s-1FAQ\s0 in the ActiveState documentation for details on how to install \s-1CPAN\s0 modules). .SH "My JPEGs (or MP3's) don't compress when I put them into Zips!" .IX Header "My JPEGs (or MP3's) don't compress when I put them into Zips!" \&\fBQ:\fR How come my JPEGs and \s-1MP3\s0's don't compress much when I put them into Zips? .PP \&\fBA:\fR Because they're already compressed. .SH "Under Windows, things lock up/get damaged" .IX Header "Under Windows, things lock up/get damaged" \&\fBQ:\fR I'm using Windows. When I try to use Archive::Zip, my machine locks up/makes funny sounds/displays a BSOD/corrupts data. How can I fix this? .PP \&\fBA:\fR First, try the newest version of Compress::Raw::Zlib. I know of Windows-related problems prior to v1.14 of that library. .SH "Zip contents in a scalar" .IX Header "Zip contents in a scalar" \&\fBQ:\fR I want to read a Zip file from (or write one to) a scalar variable instead of a file. How can I do this? .PP \&\fBA:\fR Use \f(CW\*(C`IO::String\*(C'\fR and the \f(CW\*(C`readFromFileHandle()\*(C'\fR and \&\f(CW\*(C`writeToFileHandle()\*(C'\fR methods. See \f(CW\*(C`examples/readScalar.pl\*(C'\fR and \f(CW\*(C`examples/writeScalar.pl\*(C'\fR. .SH "Reading from streams" .IX Header "Reading from streams" \&\fBQ:\fR How do I read from a stream (like for the Info-Zip \f(CW\*(C`funzip\*(C'\fR program)? .PP \&\fBA:\fR This is not currently supported, though writing to a stream is.