handy.html
来自「perl教程」· HTML 代码 · 共 165 行
HTML
165 行
<?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>ActiveState::Handy - Collection of small utility functions</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>ActiveState::Handy - Collection of small utility functions</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="#bugs">BUGS</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>ActiveState::Handy - Collection of small utility functions</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
<span class="keyword">use</span> <span class="variable">ActiveState::Handy</span> <span class="string">qw(add)</span><span class="operator">;</span>
<span class="keyword">my</span> <span class="variable">$sum</span> <span class="operator">=</span> <span class="variable">add</span><span class="operator">(</span><span class="number">1</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">3</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This module provides a collection of small utility functions.</p>
<p>The following functions are provided:</p>
<dl>
<dt><strong><a name="item_add">add( @numbers )</a></strong>
<dd>
<p>Adds the given arguments together.</p>
</dd>
</li>
<dt><strong><a name="item_cat">cat( $filename )</a></strong>
<dd>
<p>Returns the content of a file. Same as file_content( $filename ).
This function is still present for legacy reasons.</p>
</dd>
</li>
<dt><strong><a name="item_cat_text">cat_text( $filename )</a></strong>
<dd>
<p>Just like <a href="#item_cat"><code>cat()</code></a> but will read the file in text mode. Makes a
difference on some platforms (like Windows).</p>
</dd>
</li>
<dt><strong><a name="item_ceil">ceil( $number )</a></strong>
<dd>
<p>Rounds the number up to the nearest integer. Same as POSIX::ceil().</p>
</dd>
</li>
<dt><strong><a name="item_cp_files">cp_files( $from, $to, @files )</a></strong>
<dd>
<p>Copies files from source to destination directory. Destination directory
will be created if it doesn't exist. Function dies if any file cannot
be found.</p>
</dd>
</li>
<dt><strong><a name="item_cp_tree">cp_tree( $from, $to )</a></strong>
<dd>
<p>Recursively copies all files and subdirectories from source to destination
directory. All destination directories will be created if they don't
already exist.</p>
</dd>
</li>
<dt><strong><a name="item_file_content">file_content( $filename )</a></strong>
<dt><strong>file_content( $filename, $content )</strong>
<dd>
<p>Get or set the content of a file. The file I/O takes place in binary
mode.</p>
</dd>
<dd>
<p>If called with a single argument, then try to read the given file and
return <a href="../../lib/Pod/perlfunc.html#item_undef"><code>undef</code></a> if the file could not be opened.</p>
</dd>
<dd>
<p>If called with two arguments, try to write the given $content to the
file denoted by the given $filename, creating the file itself or
missing directories as needed. If the file can't be opened or created
this function will croak. There is no return value when the file is
set.</p>
</dd>
</li>
<dt><strong><a name="item_iso_date">iso_date( $time )</a></strong>
<dt><strong>iso_date( $y, $m, $d )</strong>
<dd>
<p>Returns a ISO 8601 formatted date; YYYY-MM-DD format. See
<code>http://www.cl.cam.ac.uk/~mgk25/iso-time.html</code>.</p>
</dd>
</li>
<dt><strong><a name="item_iso_datetime">iso_datetime( $time )</a></strong>
<dt><strong>iso_datetime( $y, $m, $d, $h, $m, $s )</strong>
<dd>
<p>Returns a ISO 8601 formatted timestamp; YYYY-MM-DDThh:mm:ss format. See
<code>http://www.cl.cam.ac.uk/~mgk25/iso-time.html</code>.</p>
</dd>
</li>
<dt><strong><a name="item_xml_esc">xml_esc( $text )</a></strong>
<dd>
<p>Will escape a piece of text so it can be embedded as text in an XML
element.</p>
</dd>
</li>
<dt><strong><a name="item_xml_clean">xml_clean( $text )</a></strong>
<dd>
<p>Will remove control characters so it can be embedded as text in an XML
element. Does not perform escaping.</p>
</dd>
</li>
</dl>
<p>For legacy reasons this module re-exports the functions run(),
<code>shell_quote()</code> and <code>decode_status()</code> from <code>ActiveState::Run</code>.</p>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>none.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="../../lib/ActiveState/Run.html">the ActiveState::Run manpage</a></p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?