perlos2.html

来自「perl教程」· HTML 代码 · 共 1,320 行 · 第 1/5 页

HTML
1,320 行
字号
<p>Some time ago I had reports it does not work.  Nowadays it is checked
in the Perl test suite, so grep <em>./t</em> subdirectory of the build tree
(as well as <em>*.t</em> files in the <em>./lib</em> subdirectory) to find how it
should be done &quot;correctly&quot;.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="___and_pipeopen_do_not_work_under_dos_"><code>``</code> and pipe-<a href="../../lib/Pod/perlfunc.html#item_open"><code>open</code></a> do not work under DOS.</a></h2>
<p>This may a variant of just <a href="#i_cannot_run_external_programs">I cannot run external programs</a>, or a
deeper problem. Basically: you <em>need</em> RSX (see <a href="#prerequisites">Prerequisites</a>)
for these commands to work, and you may need a port of <em>sh.exe</em> which
understands command arguments. One of such ports is listed in
<a href="#prerequisites">Prerequisites</a> under RSX. Do not forget to set variable
<code>&quot;PERL_SH_DIR&quot;</code> as well.</p>
<p>DPMI is required for RSX.</p>
<p>
</p>
<h2><a name="cannot_start_find_exe_pattern_file">Cannot start <code>find.exe &quot;pattern&quot; file</code></a></h2>
<p>The whole idea of the &quot;standard C API to start applications&quot; is that
the forms <code>foo</code> and <code>&quot;foo&quot;</code> of program arguments are completely
interchangable.  <em>find</em> breaks this paradigm;</p>
<pre>
  find &quot;pattern&quot; file
  find pattern file</pre>
<p>are not equivalent; <em>find</em> cannot be started directly using the above
API.  One needs a way to surround the doublequotes in some other
quoting construction, necessarily having an extra non-Unixish shell in
between.</p>
<p>Use one of</p>
<pre>
  <span class="keyword">system</span> <span class="string">'cmd'</span><span class="operator">,</span> <span class="string">'/c'</span><span class="operator">,</span> <span class="string">'find "pattern" file'</span><span class="operator">;</span>
  <span class="string">`cmd /c 'find "pattern" file'`</span>
</pre>
<p>This would start <em>find.exe</em> via <em>cmd.exe</em> via <code>sh.exe</code> via
<code>perl.exe</code>, but this is a price to pay if you want to use
non-conforming program.</p>
<p>
</p>
<hr />
<h1><a name="installation">INSTALLATION</a></h1>
<p>
</p>
<h2><a name="automatic_binary_installation">Automatic binary installation</a></h2>
<p>The most convenient way of installing a binary distribution of perl is via perl installer
<em>install.exe</em>. Just follow the instructions, and 99% of the
installation blues would go away.</p>
<p>Note however, that you need to have <em>unzip.exe</em> on your path, and
EMX environment <em>running</em>. The latter means that if you just
installed EMX, and made all the needed changes to <em>Config.sys</em>,
you may need to reboot in between. Check EMX runtime by running</p>
<pre>
        emxrev</pre>
<p>Binary installer also creates a folder on your desktop with some useful
objects.  If you need to change some aspects of the work of the binary
installer, feel free to edit the file <em>Perl.pkg</em>.  This may be useful
e.g., if you need to run the installer many times and do not want to
make many interactive changes in the GUI.</p>
<p><strong>Things not taken care of by automatic binary installation:</strong></p>
<dl>
<dt><strong><a name="item_perl_badlang"><code>PERL_BADLANG</code></a></strong>

<dd>
<p>may be needed if you change your codepage <em>after</em> perl installation,
and the new value is not supported by EMX. See <a href="#item_perl_badlang">PERL_BADLANG</a>.</p>
</dd>
</li>
<dt><strong><a name="item_perl_badfree"><code>PERL_BADFREE</code></a></strong>

<dd>
<p>see <a href="#item_perl_badfree">PERL_BADFREE</a>.</p>
</dd>
</li>
<dt><strong><a name="item_config_2epm"><em>Config.pm</em></a></strong>

<dd>
<p>This file resides somewhere deep in the location you installed your
perl library, find it out by</p>
</dd>
<dd>
<pre>
  <span class="variable">perl</span> <span class="operator">-</span><span class="variable">MConfig</span> <span class="operator">-</span><span class="keyword">le</span> <span class="string">"print $INC{'Config.pm'}"</span>
</pre>
</dd>
<dd>
<p>While most important values in this file <em>are</em> updated by the binary
installer, some of them may need to be hand-edited. I know no such
data, please keep me informed if you find one.  Moreover, manual
changes to the installed version may need to be accompanied by an edit
of this file.</p>
</dd>
</li>
</dl>
<p><strong>NOTE</strong>. Because of a typo the binary installer of 5.00305
would install a variable <code>PERL_SHPATH</code> into <em>Config.sys</em>. Please
remove this variable and put <code>PERL_SH_DIR</code> instead.</p>
<p>
</p>
<h2><a name="manual_binary_installation">Manual binary installation</a></h2>
<p>As of version 5.00305, OS/2 perl binary distribution comes split
into 11 components. Unfortunately, to enable configurable binary
installation, the file paths in the zip files are not absolute, but
relative to some directory.</p>
<p>Note that the extraction with the stored paths is still necessary
(default with unzip, specify <a href="../../lib/Pod/perlrun.html#item__2dd"><code>-d</code></a> to pkunzip). However, you
need to know where to extract the files. You need also to manually
change entries in <em>Config.sys</em> to reflect where did you put the
files. Note that if you have some primitive unzipper (like
<code>pkunzip</code>), you may get a lot of warnings/errors during
unzipping. Upgrade to <code>(w)unzip</code>.</p>
<p>Below is the sample of what to do to reproduce the configuration on my
machine.  In <em>VIEW.EXE</em> you can press <code>Ctrl-Insert</code> now, and
cut-and-paste from the resulting file - created in the directory you
started <em>VIEW.EXE</em> from.</p>
<p>For each component, we mention environment variables related to each
installation directory.  Either choose directories to match your
values of the variables, or create/append-to variables to take into
account the directories.</p>
<dl>
<dt><strong><a name="item_executables">Perl VIO and PM executables (dynamically linked)</a></strong>

<dd>
<pre>
  unzip perl_exc.zip *.exe *.ico -d f:/emx.add/bin
  unzip perl_exc.zip *.dll -d f:/emx.add/dll</pre>
</dd>
<dd>
<p>(have the directories with <code>*.exe</code> on PATH, and <code>*.dll</code> on
LIBPATH);</p>
</dd>
<dt><strong><a name="item_executable">Perl_ VIO executable (statically linked)</a></strong>

<dd>
<pre>
  unzip perl_aou.zip -d f:/emx.add/bin</pre>
</dd>
<dd>
<p>(have the directory on PATH);</p>
</dd>
<dt><strong><a name="item_executables_for_perl_utilities">Executables for Perl utilities</a></strong>

<dd>
<pre>
  unzip perl_utl.zip -d f:/emx.add/bin</pre>
</dd>
<dd>
<p>(have the directory on PATH);</p>
</dd>
<dt><strong><a name="item_main_perl_library">Main Perl library</a></strong>

<dd>
<pre>
  unzip perl_mlb.zip -d f:/perllib/lib</pre>
</dd>
<dd>
<p>If this directory is exactly the same as the prefix which was compiled
into <em>perl.exe</em>, you do not need to change
anything. However, for perl to find the library if you use a different
path, you need to
<code>set PERLLIB_PREFIX</code> in <em>Config.sys</em>, see <a href="#perllib_prefix">PERLLIB_PREFIX</a>.</p>
</dd>
<dt><strong><a name="item_additional_perl_modules">Additional Perl modules</a></strong>

<dd>
<pre>
  unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.8.8/</pre>
</dd>
<dd>
<p>Same remark as above applies.  Additionally, if this directory is not
one of directories on @INC (and @INC is influenced by <code>PERLLIB_PREFIX</code>), you
need to put this
directory and subdirectory <em>./os2</em> in <a href="../../lib/Pod/perlrun.html#item_perllib"><code>PERLLIB</code></a> or <a href="../../lib/Pod/perlrun.html#item_perl5lib"><code>PERL5LIB</code></a>
variable. Do not use <a href="../../lib/Pod/perlrun.html#item_perl5lib"><code>PERL5LIB</code></a> unless you have it set already. See
<a href="../../lib/Pod/perl.html#environment">ENVIRONMENT in the perl manpage</a>.</p>
</dd>
<dd>
<p><strong>[Check whether this extraction directory is still applicable with
the new directory structure layout!]</strong></p>
</dd>
<dt><strong><a name="item_tools_to_compile_perl_modules">Tools to compile Perl modules</a></strong>

<dd>
<pre>
  unzip perl_blb.zip -d f:/perllib/lib</pre>
</dd>
<dd>
<p>Same remark as for <em>perl_ste.zip</em>.</p>
</dd>
<dt><strong><a name="item_manpages_for_perl_and_utilities">Manpages for Perl and utilities</a></strong>

<dd>
<pre>
  unzip perl_man.zip -d f:/perllib/man</pre>
</dd>
<dd>
<p>This directory should better be on <code>MANPATH</code>. You need to have a
working <em>man</em> to access these files.</p>
</dd>
<dt><strong><a name="item_manpages_for_perl_modules">Manpages for Perl modules</a></strong>

<dd>
<pre>
  unzip perl_mam.zip -d f:/perllib/man</pre>
</dd>
<dd>
<p>This directory should better be on <code>MANPATH</code>. You need to have a
working man to access these files.</p>
</dd>
<dt><strong><a name="item_source_for_perl_documentation">Source for Perl documentation</a></strong>

<dd>
<pre>
  unzip perl_pod.zip -d f:/perllib/lib</pre>
</dd>
<dd>
<p>This is used by the <code>perldoc</code> program (see <a href="../../lib/Pod/perldoc.html">the perldoc manpage</a>), and may be used to
generate HTML documentation usable by WWW browsers, and
documentation in zillions of other formats: <code>info</code>, <code>LaTeX</code>,
<code>Acrobat</code>, <code>FrameMaker</code> and so on.  [Use programs such as
<em>pod2latex</em> etc.]</p>
</dd>
<dt><strong><a name="item_perl_manual_in__2einf_format">Perl manual in <em>.INF</em> format</a></strong>

<dd>
<pre>
  unzip perl_inf.zip -d d:/os2/book</pre>
</dd>
<dd>
<p>This directory should better be on <code>BOOKSHELF</code>.</p>
</dd>
<dt><strong><a name="item_pdksh">Pdksh</a></strong>

<dd>
<pre>
  unzip perl_sh.zip -d f:/bin</pre>
</dd>
<dd>
<p>This is used by perl to run external commands which explicitly
require shell, like the commands using <em>redirection</em> and <em>shell
metacharacters</em>. It is also used instead of explicit <em>/bin/sh</em>.</p>
</dd>
<dd>
<p>Set <code>PERL_SH_DIR</code> (see <a href="#perl_sh_dir">PERL_SH_DIR</a>) if you move <em>sh.exe</em> from
the above location.</p>
</dd>
<dd>
<p><strong>Note.</strong> It may be possible to use some other sh-compatible shell (untested).</p>
</dd>
</dl>
<p>After you installed the components you needed and updated the
<em>Config.sys</em> correspondingly, you need to hand-edit
<em>Config.pm</em>. This file resides somewhere deep in the location you
installed your perl library, find it out by</p>
<pre>
  <span class="variable">perl</span> <span class="operator">-</span><span class="variable">MConfig</span> <span class="operator">-</span><span class="keyword">le</span> <span class="string">"print $INC{'Config.pm'}"</span>
</pre>
<p>You need to correct all the entries which look like file paths (they
currently start with <code>f:/</code>).</p>
<p>
</p>
<h2><a name="warning"><strong>Warning</strong></a></h2>
<p>The automatic and manual perl installation leave precompiled paths
inside perl executables. While these paths are overwriteable (see

⌨️ 快捷键说明

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