checktree.html

来自「perl教程」· HTML 代码 · 共 97 行

HTML
97 行
字号
<?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>validate - run many filetest checks on a tree</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__',2);</script>
<h1><a>validate - run many filetest checks on a tree</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>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#history">HISTORY</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>validate - run many filetest checks on a tree</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">File::CheckTree</span><span class="operator">;</span>
</pre>
<pre>
    <span class="variable">$num_warnings</span> <span class="operator">=</span> <span class="variable">validate</span><span class="operator">(</span> <span class="string">q{
        /vmunix                 -e || die
        /boot                   -e || die
        /bin                    cd
            csh                 -ex
            csh                 !-ug
            sh                  -ex
            sh                  !-ug
        /usr                    -d || warn "What happened to $file?\n"
    }</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <code>validate()</code> routine takes a single multiline string consisting of
directives, each containing a filename plus a file test to try on it.
(The file test may also be a &quot;cd&quot;, causing subsequent relative filenames
to be interpreted relative to that directory.)  After the file test
you may put <code>|| die</code> to make it a fatal error if the file test fails.
The default is <code>|| warn</code>.  The file test may optionally have a &quot;!' prepended
to test for the opposite condition.  If you do a cd and then list some
relative filenames, you may want to indent them slightly for readability.
If you supply your own <a href="../../lib/Pod/perlfunc.html#item_die"><code>die()</code></a> or <a href="../../lib/Pod/perlfunc.html#item_warn"><code>warn()</code></a> message, you can use $file to
interpolate the filename.</p>
<p>Filetests may be bunched:  &quot;-rwx&quot; tests for all of <code>-r</code>, <a href="../../lib/Pod/perlrun.html#item__2dw"><code>-w</code></a>, and <a href="../../lib/Pod/perlrun.html#item__2dx"><code>-x</code></a>.
Only the first failed test of the bunch will produce a warning.</p>
<p>The routine returns the number of warnings issued.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>File::CheckTree was derived from lib/validate.pl which was
written by Larry Wall.
Revised by Paul Grassie &lt;<em><a href="mailto:grassie@perl.com">grassie@perl.com</a></em>&gt; in 2002.</p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p>File::CheckTree used to not display fatal error messages.
It used to count only those warnings produced by a generic <code>|| warn</code>
(and not those in which the user supplied the message).  In addition,
the <code>validate()</code> routine would leave the user program in whatever
directory was last entered through the use of &quot;cd&quot; directives.
These bugs were fixed during the development of perl 5.8.
The first fixed version of File::CheckTree was 4.2.</p>

</body>

</html>

⌨️ 快捷键说明

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