📄 ch08_85.htm
字号:
<html><head><title>ExtUtils::MM_Unix (Perl in a Nutshell, 2nd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Stephen Spainhour" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596002416L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Perl in a Nutshell, 2nd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Java and XSLT" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch08_84.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch08_86.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">8.85. ExtUtils::MM_Unix</h2><p><a name="INDEX-1430" />Provides methods for MakeMaker tohandle portability issues. You never need to<tt class="literal">require</tt> this module, but you might want to if youare working on improving MakeMaker's portability</p><p>Provides methods for both Unix and non-Unix systems; on non-Unixsystems, they can be overridden by methods defined in other MM_*modules. The methods are the following.</p><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>catdir</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>catdir <em class="replaceable">list</em></pre><p>Concatenates a list of directory names to form a complete path endingwith a directory. On Unix, joins the names with <tt class="literal">/</tt>.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>catfile</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>catfile <em class="replaceable">list</em></pre><p>Concatenates one or more directory names and a filename to form acomplete path ending with a filename. On Unix, joins the names with<tt class="literal">/</tt>.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>dir_target</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>dir_target <em class="replaceable">array</em></pre><p>Takes an array of required directory names and returns a<em class="emphasis">Makefile</em> entry to create an<em class="emphasis">.exists</em> file in the directories. Returns nothingif the entry has already been processed.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>file_name_is_absolute</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>file_name_is_absolute <em class="replaceable">filename</em></pre><p>Takes a path as argument and returns true if it is an absolute path.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>find_perl</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>find_perl <em class="replaceable">version</em>, \<em class="replaceable">names</em>, \<em class="replaceable">dirs</em>, <em class="replaceable">trace</em></pre><p>Searches for an executable Perl. Takes the following arguments:</p><dl><dt><i><em class="replaceable"><tt>version</tt></em></i></dt><dd>The executable must be at least the version given by<em class="replaceable"><tt>version</tt></em>.</p></dd><dt><i><em class="replaceable"><tt>\names</tt></em></i></dt><dd>Array reference. The name of the executable must be an entry in thearray.</p></dd><dt><i><em class="replaceable"><tt>\dirs</tt></em></i></dt><dd>Array reference. The executable must be in a directory that is one ofthe entries in the array.</p></dd><dt><i><em class="replaceable"><tt>trace</tt></em></i></dt><dd>If true, prints debugging information.</p></dd></dl></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>guess_name</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>guess_name</pre><p>Guesses the name of the package based on the workingdirectory's name. Called only if the NAME attributeis missing.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>has_link_code</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>has_link_code</pre><p>Returns true if there are C, XS, MYEXTLIB, or similar objects in thisobject that need a compiler. Does not descend into subdirectories.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>libscan</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>libscan <em class="replaceable">filename</em></pre><p>Uses <tt class="literal">init_dirscan</tt> to find a file; returns false ifthe file should not be included in the library. Used primarily tokeep revision-control directories from being installed.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>lsdir</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>lsdir <em class="replaceable">dir</em>, <em class="replaceable">regexp</em></pre><p>Returns all entries in the specified directory that match the regularexpression. Takes the following arguments:</p><dl><dt><i><em class="replaceable"><tt>dir</tt></em></i></dt><dd>Name of the directory</p></dd><dt><i><em class="replaceable"><tt>regexp</tt></em></i></dt><dd>Regular expression to match the entries against</p></dd></dl></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>maybe_command</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>maybe_command <em class="replaceable">filename</em></pre><p>Returns true if <em class="replaceable">filename</em> is likely to be acommand.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>maybe_command_in_dirs</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>maybe_command_in_dirs</pre><p>For future use.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>needs_linking</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>needs_linking</pre><p>Returns true if the module needs linking. Searches subdirectories.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>nicetext</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>nicetext <em class="replaceable">target</em></pre><p>The MM_Unix version returns the argument with no processing.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>path</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>path</pre><p>Returns PATH environment variable as an array.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>perl_script</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>perl_script <em class="replaceable">filename</em></pre><p>Returns true if <em class="replaceable">filename</em> is likely to be aPerl script. With MM_Unix, this is true for any ordinary, readablefile.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>prefixify</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>prefixify <em class="replaceable">attrname</em>, <em class="replaceable">oldprefix</em>, <em class="replaceable">newprefix</em></pre><p>Processes a path attribute in <tt class="literal">$self->{</tt><em class="replaceable"><tt>attrname</tt></em> <tt class="literal">}</tt>. Looks upthe attribute in <tt class="literal">%Config</tt> if itdoesn't have a value. Takes the following arguments:</p><dl><dt><i><em class="replaceable"><tt>attrname</tt></em></i></dt><dd>Name of the attribute to be processed</p></dd><dt><i><em class="replaceable"><tt>oldprefix</tt></em></i></dt><dd>Prefix to be replaced</p></dd><dt><i><em class="replaceable"><tt>newprefix</tt></em></i></dt><dd>New prefix, replaced in-place</p></dd></dl></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>replace_manpage_separator</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>replace_manpage_separator <em class="replaceable">filename</em></pre><p>Takes the filename of a package and replaces the subdirectorydelimiter (<tt class="literal">/</tt> in Unix) with <tt class="literal">::</tt>.Returns the altered name.</p></div><a name="perlnut2-CHP-8-SECT-85.1" /><div class="sect2"><h3 class="sect2">8.85.1. Methods to Produce the Makefile</h3><p>ExtUtils::MM_Unix has some additional methods that are called insequence to produce a Makefile. The list of methods is specified inthe array <tt class="literal">@ExtUtils::MakeMaker::MM_Sections</tt>, onemethod per section. The routines are all called the same way and soare just listed here. Each method returns the string to be put intoits section of the <em class="emphasis">Makefile</em>.</p><p>The methods are called in the order that they are listed in thefollowing table, reading down the columns:</p><a name="ch08-199-fm2xml" /><table border="1" cellpadding="3">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -