⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 archive::extract.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.IP "zip" 4.IX Item "zip"Zip compressed file, as produced by, for example \f(CW\*(C`/bin/zip\*(C'\fR.Corresponds to a \f(CW\*(C`.zip\*(C'\fR, \f(CW\*(C`.jar\*(C'\fR or \f(CW\*(C`.par\*(C'\fR suffix..IP "bz2" 4.IX Item "bz2"Bzip2 compressed file, as produced by, for example, \f(CW\*(C`/bin/bzip2\*(C'\fR.Corresponds to a \f(CW\*(C`.bz2\*(C'\fR suffix..IP "tbz" 4.IX Item "tbz"Bzip2 compressed tar file, as produced by, for exmample \f(CW\*(C`/bin/tar \-j\*(C'\fR.Corresponds to a \f(CW\*(C`.tbz\*(C'\fR or \f(CW\*(C`.tar.bz2\*(C'\fR suffix..PPReturns a \f(CW\*(C`Archive::Extract\*(C'\fR object on success, or false on failure..ie n .Sh "$ae\->extract( [to => '/output/path'] )".el .Sh "\f(CW$ae\fP\->extract( [to => '/output/path'] )".IX Subsection "$ae->extract( [to => '/output/path'] )"Extracts the archive represented by the \f(CW\*(C`Archive::Extract\*(C'\fR object tothe path of your choice as specified by the \f(CW\*(C`to\*(C'\fR argument. Defaults to\&\f(CW\*(C`cwd()\*(C'\fR..PPSince \f(CW\*(C`.gz\*(C'\fR files never hold a directory, but only a single file; if the \f(CW\*(C`to\*(C'\fR argument is an existing directory, the file is extracted there, with it's \f(CW\*(C`.gz\*(C'\fR suffix stripped. If the \f(CW\*(C`to\*(C'\fR argument is not an existing directory, the \f(CW\*(C`to\*(C'\fR argument is understood to be a filename, if the archive type is \f(CW\*(C`gz\*(C'\fR. In the case that you did not specify a \f(CW\*(C`to\*(C'\fR argument, the outputfile will be the name of the archive file, stripped from it's \f(CW\*(C`.gz\*(C'\fRsuffix, in the current working directory..PP\&\f(CW\*(C`extract\*(C'\fR will try a pure perl solution first, and then fall back tocommandline tools if they are available. See the \f(CW\*(C`GLOBAL VARIABLES\*(C'\fRsection below on how to alter this behaviour..PPIt will return true on success, and false on failure..PPOn success, it will also set the follow attributes in the object:.ie n .IP "$ae\->extract_path" 4.el .IP "\f(CW$ae\fR\->extract_path" 4.IX Item "$ae->extract_path"This is the directory that the files where extracted to..ie n .IP "$ae\->files" 4.el .IP "\f(CW$ae\fR\->files" 4.IX Item "$ae->files"This is an array ref with the paths of all the files in the archive,relative to the \f(CW\*(C`to\*(C'\fR argument you specified.To get the full path to an extracted file, you would use:.Sp.Vb 1\&    File::Spec\->catfile( $to, $ae\->files\->[0] );.Ve.SpNote that all files from a tar archive will be in unix format, as perthe tar specification..SH "ACCESSORS".IX Header "ACCESSORS".ie n .Sh "$ae\->error([\s-1BOOL\s0])".el .Sh "\f(CW$ae\fP\->error([\s-1BOOL\s0])".IX Subsection "$ae->error([BOOL])"Returns the last encountered error as string.Pass it a true value to get the \f(CW\*(C`Carp::longmess()\*(C'\fR output instead..ie n .Sh "$ae\->extract_path".el .Sh "\f(CW$ae\fP\->extract_path".IX Subsection "$ae->extract_path"This is the directory the archive got extracted to.See \f(CW\*(C`extract()\*(C'\fR for details..ie n .Sh "$ae\->files".el .Sh "\f(CW$ae\fP\->files".IX Subsection "$ae->files"This is an array ref holding all the paths from the archive.See \f(CW\*(C`extract()\*(C'\fR for details..ie n .Sh "$ae\->archive".el .Sh "\f(CW$ae\fP\->archive".IX Subsection "$ae->archive"This is the full path to the archive file represented by this\&\f(CW\*(C`Archive::Extract\*(C'\fR object..ie n .Sh "$ae\->type".el .Sh "\f(CW$ae\fP\->type".IX Subsection "$ae->type"This is the type of archive represented by this \f(CW\*(C`Archive::Extract\*(C'\fRobject. See accessors below for an easier way to use this.See the \f(CW\*(C`new()\*(C'\fR method for details..ie n .Sh "$ae\->types".el .Sh "\f(CW$ae\fP\->types".IX Subsection "$ae->types"Returns a list of all known \f(CW\*(C`types\*(C'\fR for \f(CW\*(C`Archive::Extract\*(C'\fR's\&\f(CW\*(C`new\*(C'\fR method..ie n .Sh "$ae\->is_tgz".el .Sh "\f(CW$ae\fP\->is_tgz".IX Subsection "$ae->is_tgz"Returns true if the file is of type \f(CW\*(C`.tar.gz\*(C'\fR.See the \f(CW\*(C`new()\*(C'\fR method for details..ie n .Sh "$ae\->is_tar".el .Sh "\f(CW$ae\fP\->is_tar".IX Subsection "$ae->is_tar"Returns true if the file is of type \f(CW\*(C`.tar\*(C'\fR.See the \f(CW\*(C`new()\*(C'\fR method for details..ie n .Sh "$ae\->is_gz".el .Sh "\f(CW$ae\fP\->is_gz".IX Subsection "$ae->is_gz"Returns true if the file is of type \f(CW\*(C`.gz\*(C'\fR.See the \f(CW\*(C`new()\*(C'\fR method for details..ie n .Sh "$ae\->is_Z".el .Sh "\f(CW$ae\fP\->is_Z".IX Subsection "$ae->is_Z"Returns true if the file is of type \f(CW\*(C`.Z\*(C'\fR.See the \f(CW\*(C`new()\*(C'\fR method for details..ie n .Sh "$ae\->is_zip".el .Sh "\f(CW$ae\fP\->is_zip".IX Subsection "$ae->is_zip"Returns true if the file is of type \f(CW\*(C`.zip\*(C'\fR.See the \f(CW\*(C`new()\*(C'\fR method for details..ie n .Sh "$ae\->bin_tar".el .Sh "\f(CW$ae\fP\->bin_tar".IX Subsection "$ae->bin_tar"Returns the full path to your tar binary, if found..ie n .Sh "$ae\->bin_gzip".el .Sh "\f(CW$ae\fP\->bin_gzip".IX Subsection "$ae->bin_gzip"Returns the full path to your gzip binary, if found.ie n .Sh "$ae\->bin_unzip".el .Sh "\f(CW$ae\fP\->bin_unzip".IX Subsection "$ae->bin_unzip"Returns the full path to your unzip binary, if found.ie n .Sh "$bool\fP = \f(CW$ae\->have_old_bunzip2".el .Sh "\f(CW$bool\fP = \f(CW$ae\fP\->have_old_bunzip2".IX Subsection "$bool = $ae->have_old_bunzip2"Older versions of \f(CW\*(C`/bin/bunzip2\*(C'\fR, from before the \f(CW\*(C`bunzip2 1.0\*(C'\fR release,require all archive names to end in \f(CW\*(C`.bz2\*(C'\fR or it will not extractthem. This method checks if you have a recent version of \f(CW\*(C`bunzip2\*(C'\fRthat allows any extension, or an older one that doesn't..SH "HOW IT WORKS".IX Header "HOW IT WORKS"\&\f(CW\*(C`Archive::Extract\*(C'\fR tries first to determine what type of archive youare passing it, by inspecting its suffix. It does not do this by usingMime magic, or something related. See \f(CW\*(C`CAVEATS\*(C'\fR below..PPOnce it has determined the file type, it knows which extraction methodsit can use on the archive. It will try a perl solution first, then fallback to a commandline tool if that fails. If that also fails, it willreturn false, indicating it was unable to extract the archive.See the section on \f(CW\*(C`GLOBAL VARIABLES\*(C'\fR to see how to alter this order..SH "CAVEATS".IX Header "CAVEATS".Sh "File Extensions".IX Subsection "File Extensions"\&\f(CW\*(C`Archive::Extract\*(C'\fR trusts on the extension of the archive to determinewhat type it is, and what extractor methods therefore can be used. Ifyour archives do not have any of the extensions as described in the\&\f(CW\*(C`new()\*(C'\fR method, you will have to specify the type explicitly, or\&\f(CW\*(C`Archive::Extract\*(C'\fR will not be able to extract the archive for you..Sh "Supporting Very Large Files".IX Subsection "Supporting Very Large Files"\&\f(CW\*(C`Archive::Extract\*(C'\fR can use either pure perl modules or command lineprograms under the hood. Some of the pure perl modules (like \&\f(CW\*(C`Archive::Tar\*(C'\fR take the entire contents of the archive into memory,which may not be feasible on your system. Consider setting the globalvariable \f(CW$Archive::Extract::PREFER_BIN\fR to \f(CW1\fR, which will preferthe use of command line programs and won't consume so much memory..PPSee the \f(CW\*(C`GLOBAL VARIABLES\*(C'\fR section below for details..Sh "Bunzip2 support of arbitrary extensions.".IX Subsection "Bunzip2 support of arbitrary extensions."Older versions of \f(CW\*(C`/bin/bunzip2\*(C'\fR do not support arbitrary file extensions and insist on a \f(CW\*(C`.bz2\*(C'\fR suffix. Although we do our bestto guard against this, if you experience a bunzip2 error, it maybe related to this. For details, please see the \f(CW\*(C`have_old_bunzip2\*(C'\fRmethod..SH "GLOBAL VARIABLES".IX Header "GLOBAL VARIABLES".ie n .Sh "$Archive::Extract::DEBUG".el .Sh "\f(CW$Archive::Extract::DEBUG\fP".IX Subsection "$Archive::Extract::DEBUG"Set this variable to \f(CW\*(C`true\*(C'\fR to have all calls to command line toolsbe printed out, including all their output.This also enables \f(CW\*(C`Carp::longmess\*(C'\fR errors, instead of the regular\&\f(CW\*(C`carp\*(C'\fR errors..PPGood for tracking down why things don't work with your particularsetup..PPDefaults to \f(CW\*(C`false\*(C'\fR..ie n .Sh "$Archive::Extract::WARN".el .Sh "\f(CW$Archive::Extract::WARN\fP".IX Subsection "$Archive::Extract::WARN"This variable controls whether errors encountered internally by\&\f(CW\*(C`Archive::Extract\*(C'\fR should be \f(CW\*(C`carp\*(C'\fR'd or not..PPSet to false to silence warnings. Inspect the output of the \f(CW\*(C`error()\*(C'\fRmethod manually to see what went wrong..PPDefaults to \f(CW\*(C`true\*(C'\fR..ie n .Sh "$Archive::Extract::PREFER_BIN".el .Sh "\f(CW$Archive::Extract::PREFER_BIN\fP".IX Subsection "$Archive::Extract::PREFER_BIN"This variables controls whether \f(CW\*(C`Archive::Extract\*(C'\fR should prefer theuse of perl modules, or commandline tools to extract archives..PPSet to \f(CW\*(C`true\*(C'\fR to have \f(CW\*(C`Archive::Extract\*(C'\fR prefer commandline tools..PPDefaults to \f(CW\*(C`false\*(C'\fR..SH "TODO".IX Header "TODO".IP "Mime magic support" 4.IX Item "Mime magic support"Maybe this module should use something like \f(CW\*(C`File::Type\*(C'\fR to determinethe type, rather than blindly trust the suffix..SH "BUG REPORTS".IX Header "BUG REPORTS"Please report bugs or other issues to <bug\-archive\-extract@rt.cpan.org<gt>..SH "AUTHOR".IX Header "AUTHOR"This module by Jos Boumans <kane@cpan.org>..SH "COPYRIGHT".IX Header "COPYRIGHT"This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -