vmsish.html
来自「perl教程」· HTML 代码 · 共 166 行
HTML
166 行
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../displayToc.js"></script>
<script language="JavaScript" src="../tocParas.js"></script>
<script language="JavaScript" src="../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../scineplex.css">
<title>vmsish - Perl pragma to control VMS-specific language features</title>
<link rel="stylesheet" href="../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',1);</script>
<h1><a>vmsish - Perl pragma to control VMS-specific language features</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>vmsish - Perl pragma to control VMS-specific language features</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
<span class="keyword">use</span> <span class="variable">vmsish</span><span class="operator">;</span>
</pre>
<pre>
<span class="keyword">use</span> <span class="variable">vmsish</span> <span class="string">'status'</span><span class="operator">;</span> <span class="comment"># or '$?'</span>
<span class="keyword">use</span> <span class="variable">vmsish</span> <span class="string">'exit'</span><span class="operator">;</span>
<span class="keyword">use</span> <span class="variable">vmsish</span> <span class="string">'time'</span><span class="operator">;</span>
</pre>
<pre>
<span class="keyword">use</span> <span class="variable">vmsish</span> <span class="string">'hushed'</span><span class="operator">;</span>
<span class="keyword">no</span> <span class="variable">vmsish</span> <span class="string">'hushed'</span><span class="operator">;</span>
<span class="variable">vmsish::hushed</span><span class="operator">(</span><span class="variable">$hush</span><span class="operator">);</span>
</pre>
<pre>
<span class="keyword">use</span> <span class="variable">vmsish</span><span class="operator">;</span>
<span class="keyword">no</span> <span class="variable">vmsish</span> <span class="string">'time'</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>If no import list is supplied, all possible VMS-specific features are
assumed. Currently, there are four VMS-specific features available:
'status' (a.k.a '$?'), 'exit', 'time' and 'hushed'.</p>
<p>If you're not running VMS, this module does nothing.</p>
<dl>
<dt><strong><a name="item_vmsish_status"><code>vmsish status</code></a></strong>
<dd>
<p>This makes <a href="../lib/Pod/perlvar.html#item__"><code>$?</code></a> and <a href="../lib/Pod/perlfunc.html#item_system"><code>system</code></a> return the native VMS exit status
instead of emulating the POSIX exit status.</p>
</dd>
</li>
<dt><strong><a name="item_vmsish_exit"><code>vmsish exit</code></a></strong>
<dd>
<p>This makes <code>exit 1</code> produce a successful exit (with status SS$_NORMAL),
instead of emulating UNIX exit(), which considers <code>exit 1</code> to indicate
an error. As with the CRTL's <a href="../lib/Pod/perlfunc.html#item_exit"><code>exit()</code></a> function, <code>exit 0</code> is also mapped
to an exit status of SS$_NORMAL, and any other argument to <a href="../lib/Pod/perlfunc.html#item_exit"><code>exit()</code></a> is
used directly as Perl's exit status.</p>
</dd>
</li>
<dt><strong><a name="item_vmsish_time"><code>vmsish time</code></a></strong>
<dd>
<p>This makes all times relative to the local time zone, instead of the
default of Universal Time (a.k.a Greenwich Mean Time, or GMT).</p>
</dd>
</li>
<dt><strong><a name="item_vmsish_hushed"><code>vmsish hushed</code></a></strong>
<dd>
<p>This suppresses printing of VMS status messages to SYS$OUTPUT and
SYS$ERROR if Perl terminates with an error status. and allows
programs that are expecting "unix-style" Perl to avoid having to parse
VMS error messages. It does not suppress any messages from Perl
itself, just the messages generated by DCL after Perl exits. The DCL
symbol $STATUS will still have the termination status, but with a
high-order bit set:</p>
</dd>
<dd>
<p>EXAMPLE:
$ perl -e"exit 44;" Non-hushed error exit
%SYSTEM-F-ABORT, abort DCL message
$ show sym $STATUS
$STATUS == "%X0000002C"</p>
</dd>
<dd>
<pre>
<span class="operator">$ </span><span class="variable">perl</span> <span class="keyword">-e</span><span class="string">"use vmsish qw(hushed); exit 44;"</span> <span class="variable">Hushed</span> <span class="variable">error</span> <span class="keyword">exit</span>
<span class="operator">$ </span><span class="variable">show</span> <span class="variable">sym</span> <span class="variable">$STATUS</span>
<span class="variable">$STATUS</span> <span class="operator">==</span> <span class="string">"%X1000002C"</span>
</pre>
</dd>
<dd>
<p>The 'hushed' flag has a global scope during compilation: the <a href="../lib/Pod/perlfunc.html#item_exit"><code>exit()</code></a> or
<a href="../lib/Pod/perlfunc.html#item_die"><code>die()</code></a> commands that are compiled after 'vmsish hushed' will be hushed
when they are executed. Doing a "no vmsish 'hushed'" turns off the
hushed flag.</p>
</dd>
<dd>
<p>The status of the hushed flag also affects output of VMS error
messages from compilation errors. Again, you still get the Perl
error message (and the code in $STATUS)</p>
</dd>
<dd>
<p>EXAMPLE:
use vmsish 'hushed'; # turn on hushed flag
use Carp; # Carp compiled hushed
exit 44; # will be hushed
croak('I die'); # will be hushed
no vmsish 'hushed'; # turn off hushed flag
exit 44; # will not be hushed
croak('I die2'): # WILL be hushed, croak was compiled hushed</p>
</dd>
<dd>
<p>You can also control the 'hushed' flag at run-time, using the built-in
routine vmsish::hushed(). Without argument, it returns the hushed status.
Since vmsish::hushed is built-in, you do not need to "use vmsish" to call
it.</p>
</dd>
<dd>
<p>EXAMPLE:
if ($quiet_exit) {
vmsish::hushed(1);
}
print "Sssshhhh...I'm hushed...\n" if vmsish::hushed();
exit 44;</p>
</dd>
<dd>
<p>Note that an <a href="../lib/Pod/perlfunc.html#item_exit"><code>exit()</code></a> or <a href="../lib/Pod/perlfunc.html#item_die"><code>die()</code></a> that is compiled 'hushed' because of "use
vmsish" is not un-hushed by calling vmsish::hushed(0) at runtime.</p>
</dd>
<dd>
<p>The messages from error exits from inside the Perl core are generally
more serious, and are not suppressed.</p>
</dd>
</li>
</dl>
<p>See <a href="../lib/Pod/perlmod.html#pragmatic_modules">Pragmatic Modules in the perlmod manpage</a>.</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?