[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
www/software/perl/manual index.html perldoc-all...
From: |
karl |
Subject: |
www/software/perl/manual index.html perldoc-all... |
Date: |
Sat, 04 Apr 2015 16:15:00 +0000 |
CVSROOT: /web/www
Module name: www
Changes by: karl <karl> 15/04/04 16:14:59
Modified files:
software/perl/manual: index.html perldoc-all.dvi.gz
perldoc-all.html perldoc-all.html.gz
perldoc-all.html_chapter.tar.gz
perldoc-all.info.tar.gz perldoc-all.pdf
perldoc-all.texi.tar.gz
Log message:
perl 5.20.2 doc update
CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/index.html?cvsroot=www&r1=1.8&r2=1.9
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.dvi.gz?cvsroot=www&rev=1.8
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.html?cvsroot=www&r1=1.7&r2=1.8
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.html.gz?cvsroot=www&rev=1.8
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.html_chapter.tar.gz?cvsroot=www&rev=1.8
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.info.tar.gz?cvsroot=www&rev=1.8
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.pdf?cvsroot=www&rev=1.8
http://web.cvs.savannah.gnu.org/viewcvs/www/software/perl/manual/perldoc-all.texi.tar.gz?cvsroot=www&rev=1.8
Patches:
Index: index.html
===================================================================
RCS file: /web/www/www/software/perl/manual/index.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- index.html 2 Dec 2014 22:11:04 -0000 1.8
+++ index.html 4 Apr 2015 16:14:51 -0000 1.9
@@ -4,7 +4,7 @@
<h2>Perl documentation in Texinfo</h2>
<address>GNU Project</address>
-<address>last updated October 12, 2014</address>
+<address>last updated April 04, 2015</address>
<p>This translation of the <a href="http://perldoc.perl.org/">Perl
documentation</a> from POD to Texinfo is not official, and not endorsed
@@ -21,19 +21,21 @@
<ul>
<li><a href="perldoc-all.html">HTML
- (5464K bytes)</a> - entirely on one web page.</li>
+ (5468K bytes)</a> - entirely on one web page.</li>
+<li><a href="html_chapter/index.html">HTML</a> - with one web page per
+ chapter.</li>
<li><a href="perldoc-all.html.gz">HTML compressed
- (1320K gzipped characters)</a> - entirely on
+ (1324K gzipped characters)</a> - entirely on
one web page.</li>
<li><a href="perldoc-all.html_chapter.tar.gz">HTML compressed
(1768K gzipped tar file)</a> -
with one web page per chapter.</li>
<li><a href="perldoc-all.info.tar.gz">Info document
- (1184K bytes gzipped tar file)</a>.</li>
+ (1188K bytes gzipped tar file)</a>.</li>
<li><a href="perldoc-all.dvi.gz">TeX dvi file
- (1748K bytes gzipped)</a>.</li>
+ (1752K bytes gzipped)</a>.</li>
<li><a href="perldoc-all.pdf">PDF file
- (3944K bytes)</a>.</li>
+ (3988K bytes)</a>.</li>
<li><a href="perldoc-all.texi.tar.gz">Texinfo source
(1132K bytes gzipped tar file).</a></li>
</ul>
@@ -42,7 +44,7 @@
some manuals</a> (among other items) from the Free Software Foundation;
this helps support FSF activities.</p>
-<p>(This page generated by the <a
href="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh">gendocs.sh
+<p>(This page generated by the <a
href="http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh">gendocs.sh
script</a>.)</p>
<!-- If needed, change the copyright block at the bottom. In general,
Index: perldoc-all.dvi.gz
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.dvi.gz,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
Binary files /tmp/cvs1koLYn and /tmp/cvsT7uLCY differ
Index: perldoc-all.html
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- perldoc-all.html 14 Oct 2014 22:40:46 -0000 1.7
+++ perldoc-all.html 4 Apr 2015 16:14:52 -0000 1.8
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
-<!-- Created by Texinfo 5.2dev+dev, http://www.gnu.org/software/texinfo/ -->
+<!-- Created by Texinfo 5.9.90+dev, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Perl pod documentation</title>
@@ -16,16 +16,16 @@
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
+blockquote.indentedblock {margin-right: 0em}
+blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
-div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
-div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
-kbd {font-style:oblique}
+kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
@@ -34,10 +34,10 @@
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
-span.nocodebreak {white-space:nowrap}
-span.nolinebreak {white-space:nowrap}
-span.roman {font-family:serif; font-weight:normal}
-span.sansserif {font-family:sans-serif; font-weight:normal}
+span.nocodebreak {white-space: nowrap}
+span.nolinebreak {white-space: nowrap}
+span.roman {font-family: serif; font-weight: normal}
+span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
@@ -45,7 +45,7 @@
</head>
-<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF"
vlink="#800080" alink="#FF0000">
+<body lang="en">
<h1 class="settitle" align="center">Perl pod documentation</h1>
<a name="SEC_Overview"></a>
@@ -1108,12 +1108,13 @@
<li><a name="toc-NAME-39" href="#perlmod-NAME">40.1 NAME</a></li>
<li><a name="toc-DESCRIPTION-39" href="#perlmod-DESCRIPTION">40.2
DESCRIPTION</a>
<ul class="no-bullet">
- <li><a name="toc-Packages" href="#perlmod-Packages">40.2.1
Packages</a></li>
- <li><a name="toc-Symbol-Tables" href="#perlmod-Symbol-Tables">40.2.2
Symbol Tables</a></li>
- <li><a name="toc-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END"
href="#perlmod-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END">40.2.3 BEGIN,
UNITCHECK, CHECK, INIT and END</a></li>
- <li><a name="toc-Perl-Classes" href="#perlmod-Perl-Classes">40.2.4 Perl
Classes</a></li>
- <li><a name="toc-Perl-Modules" href="#perlmod-Perl-Modules">40.2.5 Perl
Modules</a></li>
- <li><a name="toc-Making-your-module-threadsafe"
href="#perlmod-Making-your-module-threadsafe">40.2.6 Making your module
threadsafe</a></li>
+ <li><a name="toc-Is-this-the-document-you-were-after_003f"
href="#perlmod-Is-this-the-document-you-were-after_003f">40.2.1 Is this the
document you were after?</a></li>
+ <li><a name="toc-Packages" href="#perlmod-Packages">40.2.2
Packages</a></li>
+ <li><a name="toc-Symbol-Tables" href="#perlmod-Symbol-Tables">40.2.3
Symbol Tables</a></li>
+ <li><a name="toc-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END"
href="#perlmod-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END">40.2.4 BEGIN,
UNITCHECK, CHECK, INIT and END</a></li>
+ <li><a name="toc-Perl-Classes" href="#perlmod-Perl-Classes">40.2.5 Perl
Classes</a></li>
+ <li><a name="toc-Perl-Modules" href="#perlmod-Perl-Modules">40.2.6 Perl
Modules</a></li>
+ <li><a name="toc-Making-your-module-threadsafe"
href="#perlmod-Making-your-module-threadsafe">40.2.7 Making your module
threadsafe</a></li>
</ul></li>
<li><a name="toc-SEE-ALSO-19" href="#perlmod-SEE-ALSO">40.3 SEE
ALSO</a></li>
</ul></li>
@@ -4285,7 +4286,9 @@
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
DESCRIPTION
-</pre></th></tr><tr><td align="left" valign="top">• <a
href="#perlmod-Packages">perlmod Packages</a>:</td><td> </td><td
align="left" valign="top">
+</pre></th></tr><tr><td align="left" valign="top">• <a
href="#perlmod-Is-this-the-document-you-were-after_003f">perlmod Is this the
document you were after?</a>:</td><td> </td><td align="left"
valign="top">
+</td></tr>
+<tr><td align="left" valign="top">• <a href="#perlmod-Packages">perlmod
Packages</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a
href="#perlmod-Symbol-Tables">perlmod Symbol
Tables</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
@@ -6731,6 +6734,7 @@
perllocale Perl locale support
perluniintro Perl Unicode introduction
perlunicode Perl Unicode support
+ perlunicook Perl Unicode cookbook
perlunifaq Perl Unicode FAQ
perluniprops Index of Unicode properties in Perl
perlunitut Perl Unicode tutorial
@@ -6803,13 +6807,15 @@
perlhist Perl history records
perldelta Perl changes since previous version
+ perl5201delta Perl changes in version 5.20.1
perl5200delta Perl changes in version 5.20.0
+ perl5184delta Perl changes in version 5.18.4
perl5182delta Perl changes in version 5.18.2
perl5181delta Perl changes in version 5.18.1
perl5180delta Perl changes in version 5.18.0
- perl5161delta Perl changes in version 5.16.1
- perl5162delta Perl changes in version 5.16.2
perl5163delta Perl changes in version 5.16.3
+ perl5162delta Perl changes in version 5.16.2
+ perl5161delta Perl changes in version 5.16.1
perl5160delta Perl changes in version 5.16.0
perl5144delta Perl changes in version 5.14.4
perl5143delta Perl changes in version 5.14.3
@@ -16882,6 +16888,12 @@
wasn’t a symbol table entry.
</p>
</dd>
+<dt>Bad symbol for scalar</dt>
+<dd><a name="perldiag-Bad-symbol-for-scalar"></a>
+<p>(P) An internal request asked to add a scalar entry to something that
+wasn’t a symbol table entry.
+</p>
+</dd>
<dt>Bareword found in conditional</dt>
<dd><a name="perldiag-Bareword-found-in-conditional"></a>
<p>(W bareword) The compiler found a bareword where it expected a
@@ -17489,6 +17501,13 @@
method, nor does any of its base classes. See <a href="#perlobj-NAME">perlobj
NAME</a>.
</p>
</dd>
+<dt>Can’t locate object method "%s" via package "%s"
(perhaps you forgot to load "%s"?)</dt>
+<dd><a
name="perldiag-Can_0027t-locate-object-method-_0022_0025s_0022-via-package-_0022_0025s_0022-_0028perhaps-you-forgot-to-load-_0022_0025s_0022_003f_0029"></a>
+<p>(F) You called a method on a class that did not exist, and the method
+could not be found in UNIVERSAL. This often means that a method
+requires a package that has not been loaded.
+</p>
+</dd>
<dt>Can’t locate package %s for @%s::ISA</dt>
<dd><a
name="perldiag-Can_0027t-locate-package-_0025s-for-_0040_0025s_003a_003aISA"></a>
<p>(W syntax) The @ISA array contained the name of another package that
@@ -17968,9 +17987,10 @@
<dt>"\c%c" is more clearly written simply as "%s"</dt>
<dd><a
name="perldiag-_0022_005cc_0025c_0022-is-more-clearly-written-simply-as-_0022_0025s_0022"></a>
<p>(W syntax) The <code>\c<em>X</em></code> construct is intended to be a way
to specify
-non-printable characters. You used it for a printable one, which is better
-written as simply itself, perhaps preceded by a backslash for non-word
-characters.
+non-printable characters. You used it for a printable one, which
+is better written as simply itself, perhaps preceded by a backslash
+for non-word characters. Doing it the way you did is not portable
+between ASCII and EBCDIC platforms.
</p>
</dd>
<dt>Cloning substitution context is unimplemented</dt>
@@ -18890,7 +18910,7 @@
</dd>
<dt>Ignoring zero length \N{} in character class in regex; marked by
<– HERE<!-- /@w --> in m/%s/</dt>
<dd><a
name="perldiag-Ignoring-zero-length-_005cN_007b_007d-in-character-class-in-regex_003b-marked-by-_003c_002d_002d-HERE-in-m_002f_0025s_002f"></a>
-<p>(W regexp) Named Unicode character escapes <code>(\N{...})</code> may
return a
+<p>(W regexp) Named Unicode character escapes (<code>\N{...}</code>) may
return a
zero-length sequence. When such an escape is used in a character class
its behaviour is not well defined. Check that the correct escape has
been used, and the correct charname handler is in scope.
@@ -19297,7 +19317,7 @@
<dt>Invalid negative number (%s) in chr</dt>
<dd><a name="perldiag-Invalid-negative-number-_0028_0025s_0029-in-chr"></a>
<p>(W utf8) You passed a negative number to <code>chr</code>. Negative
numbers are
-not valid characters numbers, so it return the Unicode replacement
+not valid character numbers, so it returns the Unicode replacement
character (U+FFFD).
</p>
</dd>
@@ -19888,6 +19908,9 @@
<p>(F) Missing right brace in <code>\x{...}</code>, <code>\p{...}</code>,
<code>\P{...}</code>, or <code>\N{...}</code>.
</p>
</dd>
+<dt>Missing right brace on \N{}</dt>
+<dd><a name="perldiag-Missing-right-brace-on-_005cN_007b_007d"></a>
+</dd>
<dt>Missing right brace on \N{} or unescaped left brace after \N</dt>
<dd><a
name="perldiag-Missing-right-brace-on-_005cN_007b_007d-or-unescaped-left-brace-after-_005cN"></a>
<p>(F) <code>\N</code> has two meanings.
@@ -20137,7 +20160,7 @@
</dd>
<dt>\N{} in character class restricted to one character in regex; marked by
<– HERE<!-- /@w --> in m/%s/</dt>
<dd><a
name="perldiag-_005cN_007b_007d-in-character-class-restricted-to-one-character-in-regex_003b-marked-by-_003c_002d_002d-HERE-in-m_002f_0025s_002f"></a>
-<p>(F) Named Unicode character escapes <code>(\N{...})</code> may return a
+<p>(F) Named Unicode character escapes (<code>\N{...}</code>) may return a
multi-character sequence. Such an escape may not be used in
a character class, because character classes always match one
character of input. Check that the correct escape has been used,
@@ -21116,13 +21139,6 @@
redirected it with select().)
</p>
</dd>
-<dt>(perhaps you forgot to load "%s"?)</dt>
-<dd><a
name="perldiag-_0028perhaps-you-forgot-to-load-_0022_0025s_0022_003f_0029"></a>
-<p>(F) This is an educated guess made in conjunction with the message
-"Can’t locate object method \"%s\" via package
\"%s\"". It often means
-that a method requires a package that has not been loaded.
-</p>
-</dd>
<dt>Perl folding rules are not up-to-date for 0x%X; please use the perlbug
utility to report; in regex; marked by <– HERE<!-- /@w --> in
m/%s/</dt>
<dd><a
name="perldiag-Perl-folding-rules-are-not-up_002dto_002ddate-for-0x_0025X_003b-please-use-the-perlbug-utility-to-report_003b-in-regex_003b-marked-by-_003c_002d_002d-HERE-in-m_002f_0025s_002f"></a>
<p>(S regexp) You used a regular expression with case-insensitive matching,
@@ -24017,7 +24033,7 @@
</dd>
<dt>Zero length \N{} in regex; marked by <– HERE<!-- /@w --> in
m/%s/</dt>
<dd><a
name="perldiag-Zero-length-_005cN_007b_007d-in-regex_003b-marked-by-_003c_002d_002d-HERE-in-m_002f_0025s_002f"></a>
-<p>(F) Named Unicode character escapes <code>(\N{...})</code> may return a
zero-length
+<p>(F) Named Unicode character escapes (<code>\N{...}</code>) may return a
zero-length
sequence. Such an escape was used in an extended character class, i.e.
<code>(?[...])</code>, which is not permitted. Check that the correct escape
has
been used, and the correct charnames handler is in scope. The
<– HERE<!-- /@w -->
@@ -28832,6 +28848,17 @@
<p>Introduced in Perl 5.18
</p>
</dd>
+<dt>Subroutine signatures</dt>
+<dd><a name="perlexperiment-Subroutine-signatures"></a>
+<p>Introduced in Perl 5.20.0
+</p>
+<p>Using this feature triggers warnings in the category
+<code>experimental::signatures</code>.
+</p>
+<p>The ticket for this feature is
+<a href="https://rt.perl.org/Ticket/Display.html?id=121481">[perl #121481]</a>.
+</p>
+</dd>
<dt>Postfix dereference syntax</dt>
<dd><a name="perlexperiment-Postfix-dereference-syntax"></a>
<p>Introduced in Perl 5.20.0
@@ -30064,7 +30091,7 @@
after their pseudo-children have exited.
</p>
<p>Starting with Perl 5.14 a parent will not wait() automatically
-for any child that has been signalled with <code>sig('TERM', ...)</code>
+for any child that has been signalled with <code>kill('TERM', ...)</code>
to avoid a deadlock in case the child is blocking on I/O and
never receives the signal.
</p>
@@ -31633,7 +31660,8 @@
context, returns the caller’s package name if there <em>is</em> a caller
(that is, if
we’re in a subroutine or <code>eval</code> or <code>require</code>) and
the undefined value
otherwise. caller never returns XS subs and they are skipped. The next pure
-perl sub will appear instead of the XS sub in caller’s return values. In
list
+perl sub will appear instead of the XS
+sub in caller’s return values. In list
context, caller returns
</p>
<pre class="verbatim"> # 0 1 2
@@ -32248,8 +32276,9 @@
still tests true for exists(), or to 0 if none do. In other words, an
array won’t have trailing nonexistent elements after a delete.
</p>
-<p><strong>WARNING:</strong> Calling delete on array values is deprecated and
likely to
-be removed in a future version of Perl.
+<p><strong>WARNING:</strong> Calling <code>delete</code> on array values is
strongly discouraged. The
+notion of deleting or checking the existence of Perl array elements is not
+conceptually coherent, and can lead to surprising behavior.
</p>
<p>Deleting from <code>%ENV</code> modifies the environment. Deleting from a
hash tied to
a DBM file deletes the entry from the DBM file. Deleting from a
<code>tied</code> hash
@@ -32913,9 +32942,11 @@
print "True\n" if $hash{$key};
</pre>
<p>exists may also be called on array elements, but its behavior is much less
-obvious and is strongly tied to the use of ‘delete’ on arrays.
<strong>Be aware</strong>
-that calling exists on array values is deprecated and likely to be removed in
-a future version of Perl.
+obvious and is strongly tied to the use of ‘delete’ on arrays.
+</p>
+<p><strong>WARNING:</strong> Calling <code>exists</code> on array values is
strongly discouraged. The
+notion of deleting or checking the existence of Perl array elements is not
+conceptually coherent, and can lead to surprising behavior.
</p>
<pre class="verbatim"> print "Exists\n" if exists
$array[$index];
print "Defined\n" if defined $array[$index];
@@ -34128,7 +34159,7 @@
rules for the remaining code points (this last can only happen if
the UTF8 flag is also set). See <a href="#perllocale-NAME">perllocale
NAME</a>.
</p>
-<p>Starting in v5.20, Perl wil use full Unicode rules if the locale is
+<p>Starting in v5.20, Perl uses full Unicode rules if the locale is
UTF-8. Otherwise, there is a deficiency in this scheme, which is that
case changes that cross the 255/256
boundary are not well-defined. For example, the lower case of LATIN CAPITAL
@@ -34432,12 +34463,13 @@
doesn’t it won’t realize something is wrong until it gets to the
<code>}</code> and
encounters the missing (or unexpected) comma. The syntax error will be
reported close to the <code>}</code>, but you’ll need to change
something near the <code>{</code>
-such as using a unary <code>+</code> to give Perl some help:
+such as using a unary <code>+</code> or semicolon to give Perl some help:
</p>
<pre class="verbatim"> %hash = map { "\L$_" => 1 } @array #
perl guesses EXPR. wrong
%hash = map { +"\L$_" => 1 } @array # perl guesses BLOCK.
right
- %hash = map { ("\L$_" => 1) } @array # this also works
- %hash = map { lc($_) => 1 } @array # as does this.
+ %hash = map {; "\L$_" => 1 } @array # this also works
+ %hash = map { ("\L$_" => 1) } @array # as does this
+ %hash = map { lc($_) => 1 } @array # and this.
%hash = map +( lc($_) => 1 ), @array # this is EXPR and works!
%hash = map ( lc($_), 1 ), @array # evaluates to (1, @array)
@@ -35113,7 +35145,8 @@
</p>
<p>This means that when <code>use strict 'vars'</code> is in effect,
<code>our</code> lets you use
a package variable without qualifying it with the package name, but only within
-the lexical scope of the <code>our</code> declaration.
+the lexical scope of the <code>our</code> declaration. This applies
immediately–even
+within the same statement.
</p>
<pre class="verbatim"> package Foo;
use strict;
@@ -35139,6 +35172,16 @@
print $Foo::foo; # prints 23
</pre>
+<p>Because the variable becomes legal immediately under <code>use strict
'vars'</code>, so
+long as there is no variable with that name is already in scope, you can then
+reference the package variable again even within the same statement.
+</p>
+<pre class="verbatim"> package Foo;
+ use strict;
+
+ my $foo = $foo; # error, undeclared $foo on right-hand side
+ our $foo = $foo; # no errors
+</pre>
<p>If more than one variable is listed, the list must be placed
in parentheses.
</p>
@@ -38241,7 +38284,8 @@
</p>
<p><code>state</code> variables are enabled only when the <code>use feature
"state"</code> pragma
is in effect, unless the keyword is written as <code>CORE::state</code>.
-See also <a href="feature.html#Top">(feature)</a>.
+See also <a href="feature.html#Top">(feature)</a>. Alternately, include a
<code>use v5.10</code> or later to the
+current scope.
</p>
</dd>
<dt>study SCALAR</dt>
@@ -39163,15 +39207,19 @@
<code>use</code>ing library modules that won’t work with older versions
of Perl.
(We try not to do this more than we have to.)
</p>
-<p><code>use VERSION</code> also enables all features available in the
requested
+<p><code>use VERSION</code> also lexically enables all features available in
the requested
version as defined by the <code>feature</code> pragma, disabling any features
not in the requested version’s feature bundle. See <a
href="feature.html#Top">(feature)</a>.
Similarly, if the specified Perl version is greater than or equal to
5.12.0, strictures are enabled lexically as
with <code>use strict</code>. Any explicit use of
<code>use strict</code> or <code>no strict</code> overrides <code>use
VERSION</code>, even if it comes
-before it. In both cases, the <samp>feature.pm</samp> and
<samp>strict.pm</samp> files are
-not actually loaded.
+before it. Later use of <code>use VERSION</code>
+will override all behavior of a previous
+<code>use VERSION</code>, possibly removing the <code>strict</code> and
<code>feature</code> added by
+<code>use VERSION</code>. <code>use VERSION</code> does not
+load the <samp>feature.pm</samp> or <samp>strict.pm</samp>
+files.
</p>
<p>The <code>BEGIN</code> forces the <code>require</code> and
<code>import</code> to happen at compile time. The
<code>require</code> makes sure the module is loaded into memory if it
hasn’t been
@@ -39600,8 +39648,8 @@
Note that a return value of <code>-1</code> could mean that child processes are
being automatically reaped, as described in <a href="#perlipc-NAME">perlipc
NAME</a>.
</p>
-<p>If you use wait in your handler for $SIG{CHLD} it may accidentally for the
-child created by qx() or system(). See <a href="#perlipc-NAME">perlipc
NAME</a> for details.
+<p>If you use <code>wait</code> in your handler for $SIG{CHLD}, it may
accidentally wait
+for the child created by qx() or system(). See <a
href="#perlipc-NAME">perlipc NAME</a> for details.
</p>
<p>Portability issues: <a href="#perlport-wait">perlport wait</a>.
</p>
@@ -39909,9 +39957,6 @@
<dt>else</dt>
<dd><a name="perlfunc-else"></a>
</dd>
-<dt>elseif</dt>
-<dd><a name="perlfunc-elseif"></a>
-</dd>
<dt>elsif</dt>
<dd><a name="perlfunc-elsif"></a>
</dd>
@@ -39935,6 +39980,15 @@
<p>These flow-control keywords are documented in <a
href="#perlsyn-Compound-Statements">perlsyn Compound Statements</a>.
</p>
</dd>
+<dt>elseif</dt>
+<dd><a name="perlfunc-elseif"></a>
+<p>The "else if" keyword is spelled <code>elsif</code> in Perl.
There’s no <code>elif</code>
+or <code>else if</code> either. It does parse <code>elseif</code>, but only
to warn you
+about not using it.
+</p>
+<p>See the documentation for flow-control keywords in <a
href="#perlsyn-Compound-Statements">perlsyn Compound Statements</a>.
+</p>
+</dd>
</dl>
<dl compact="compact">
@@ -40287,12 +40341,12 @@
</pre>
<p>Now you should create a patch file for all your local changes:
</p>
-<pre class="verbatim"> % git format-patch -M origin..
+<pre class="verbatim"> % git format-patch -M blead..
0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
</pre>
<p>Or for a lot of changes, e.g. from a topic branch:
</p>
-<pre class="verbatim"> % git format-patch --stdout -M origin.. >
topic-branch-changes.patch
+<pre class="verbatim"> % git format-patch --stdout -M blead.. >
topic-branch-changes.patch
</pre>
<p>You should now send an email to
<a href="mailto:address@hidden">address@hidden</a> with a description of your
@@ -40303,8 +40357,8 @@
<a href="mailto:address@hidden">address@hidden</a> directly if the
patch is not ready to be applied, but intended for discussion.
</p>
-<p>See the next section for how to configure and use git to send these
-emails for you.
+<p>Please do not use git-send-email(1) to send your patch. See <a
href="#perlgit-Sending-patch-emails">Sending
+patch emails</a> for more information.
</p>
<p>If you want to delete your temporary branch, you may do so with:
</p>
@@ -40372,7 +40426,7 @@
<p>After you’ve generated your patch you should sent it
to address@hidden (as discussed <a href="#perlgit-Patch-workflow">in the
previous
-section</a> with a normal mail client as an
+section</a>) with a normal mail client as an
attachment, along with a description of the patch.
</p>
<p>You <strong>must not</strong> use git-send-email(1) to send patches
generated with
@@ -43483,7 +43537,7 @@
targets for opcodes. A previous version of this document
stated that one can deduce that an SV lives on a scratchpad
by looking on its flags: lexicals have <code>SVs_PADMY</code> set, and
-<em>target</em>s have <code>SVs_PADTMP</code> set. But this have never been
fully true.
+<em>target</em>s have <code>SVs_PADTMP</code> set. But this has never been
fully true.
<code>SVs_PADMY</code> could be set on a variable that no longer resides in
any pad.
While <em>target</em>s do have <code>SVs_PADTMP</code> set, it can also be set
on variables
that have never resided in a pad, but nonetheless act like <em>target</em>s.
@@ -45322,8 +45376,7 @@
"porters".
</p>
<p>A searchable archive of the list is available at
-<a
href="http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/">http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/</a>.
There is
-also another archive at
+<a
href="http://markmail.org/search/?q=perl5-porters">http://markmail.org/search/?q=perl5-porters</a>.
There is also an archive at
<a
href="http://archive.develooper.com/address@hidden/">http://archive.develooper.com/address@hidden/</a>.
</p>
<table class="menu" border="0" cellspacing="0">
@@ -49170,6 +49223,10 @@
Ricardo 5.18.1-RC3 2013-Aug-08
Ricardo 5.18.1 2013-Aug-12
Ricardo 5.18.2 2014-Jan-06
+ Ricardo 5.18.3-RC1 2014-Sep-17
+ Ricardo 5.18.3-RC2 2014-Sep-27
+ Ricardo 5.18.3 2014-Oct-01
+ Ricardo 5.18.4 2014-Oct-01
Ricardo 5.19.0 2013-May-20 The 5.19 development track
David G 5.19.1 2013-Jun-21
@@ -49189,11 +49246,18 @@
Steve 5.20.1-RC1 2014-Aug-25
Steve 5.20.1-RC2 2014-Sep-07
Steve 5.20.1 2014-Sep-14
+ Steve 5.20.2-RC1 2015-Jan-31
+ Steve 5.20.2 2015-Feb-14
Ricardo 5.21.0 2014-May-27 The 5.21 development track
Matthew H 5.21.1 2014-Jun-20
Abigail 5.21.2 2014-Jul-20
Peter 5.21.3 2014-Aug-20
+ Steve 5.21.4 2014-Sep-20
+ Abigail 5.21.5 2014-Oct-20
+ BinGOs 5.21.6 2014-Nov-20
+ Max M 5.21.7 2014-Dec-20
+ Matthew H 5.21.8 2015-Jan-20
</pre>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a
href="#perlhist-SELECTED-RELEASE-SIZES" accesskey="1">perlhist SELECTED RELEASE
SIZES</a>:</td><td> </td><td align="left" valign="top">
@@ -51723,7 +51787,7 @@
{
PerlIOl * next; /* Lower layer */
PerlIO_funcs * tab; /* Functions for this layer */
- IV flags; /* Various flags for state */
+ U32 flags; /* Various flags for state */
};
</pre>
<p>A <code>PerlIOl *</code> is a pointer to the struct, and the
<em>application</em>
@@ -53011,12 +53075,15 @@
located in the subroutine <code>code()</code>, which just prints some debugging
info to show that it works; it should be replaced with the real code.
</p>
-<pre class="verbatim"> #!/usr/bin/perl -w
+<pre class="verbatim"> #!/usr/bin/perl
+
+ use strict;
+ use warnings;
use POSIX ();
use FindBin ();
use File::Basename ();
- use File::Spec::Functions;
+ use File::Spec::Functions qw(catfile);
$| = 1;
@@ -53037,9 +53104,9 @@
print "PID: $$\n";
print "ARGV: @ARGV\n";
my $count = 0;
- while (++$count) {
+ while (1) {
sleep 2;
- print "$count\n";
+ print ++$count, "\n";
}
}
</pre>
@@ -55341,6 +55408,10 @@
# restore the old locale
setlocale(LC_CTYPE, $old_locale);
</pre>
+<p>This simultaneously affects all threads of the program, so it may be
+problematic to use locales in threaded applications except where there
+is a single locale applicable to all threads.
+</p>
<p>The first argument of <code>setlocale()</code> gives the
<strong>category</strong>, the second the
<strong>locale</strong>. The category tells in what aspect of data processing
you
want to apply locale-specific rules. Category names are discussed in
@@ -55534,7 +55605,7 @@
</p>
<p>You can test out changing these variables temporarily, and if the
new settings seem to help, put those settings into your shell startup
-files. Consult your local documentation for the exact details. For in
+files. Consult your local documentation for the exact details. For
Bourne-like shells (<strong>sh</strong>, <strong>ksh</strong>,
<strong>bash</strong>, <strong>zsh</strong>):
</p>
<pre class="verbatim"> LC_ALL=en_US.ISO8859-1
@@ -55546,7 +55617,7 @@
</p>
<pre class="verbatim"> setenv LC_ALL en_US.ISO8859-1
</pre>
-<p>or if you have the "env" application you can do in any shell
+<p>or if you have the "env" application you can do (in any shell)
</p>
<pre class="verbatim"> env LC_ALL=en_US.ISO8859-1 perl ...
</pre>
@@ -55771,7 +55842,7 @@
"color" follows "chocolate" in English, what about in
traditional Spanish?
</p>
<p>The following collations all make sense and you may meet any of them
-if you "use locale".
+if you <code>"use locale"</code>.
</p>
<pre class="verbatim"> A B C D E a b c d e
A a B b C c D d E e
@@ -55807,7 +55878,7 @@
dictionary-like ordering that ignores space characters completely and
which folds case.
</p>
-<p>Perl only supports single-byte locales for <code>LC_COLLATE</code>. This
means
+<p>Perl currently only supports single-byte locales for
<code>LC_COLLATE</code>. This means
that a UTF-8 locale likely will just give you machine-native ordering.
Use <a href="Unicode-Collate.html#Top">(Unicode-Collate)</a> for the full
implementation of the Unicode
Collation Algorithm.
@@ -55873,15 +55944,16 @@
</p>
<p>The <code>LC_CTYPE</code> locale also provides the map used in
transliterating
characters between lower and uppercase. This affects the case-mapping
-functions–<code>fc()</code>, <code>lc()</code>, <code>lcfirst()</code>,
<code>uc()</code>, and <code>ucfirst()</code>; case-mapping
+functions–<code>fc()</code>, <code>lc()</code>, <code>lcfirst()</code>,
<code>uc()</code>, and <code>ucfirst()</code>;
+case-mapping
interpolation with <code>\F</code>, <code>\l</code>, <code>\L</code>,
<code>\u</code>, or <code>\U</code> in double-quoted
strings and <code>s///</code> substitutions; and case-independent regular
expression
pattern matching using the <code>i</code> modifier.
</p>
<p>Finally, <code>LC_CTYPE</code> affects the (deprecated) POSIX
character-class test
functions–<code>POSIX::isalpha()</code>, <code>POSIX::islower()</code>,
and so on. For
-example, if you move from the "C" locale to a 7-bit Scandinavian one,
-you may find–possibly to your surprise–that "|" moves
from the
+example, if you move from the "C" locale to a 7-bit ISO 646 one,
+you may find–possibly to your surprise–that
<code>"|"</code> moves from the
<code>POSIX::ispunct()</code> class to <code>POSIX::isalpha()</code>.
Unfortunately, this creates big problems for regular expressions.
"|" still
means alternation even though it matches <code>\w</code>.
@@ -55889,7 +55961,7 @@
<p>Starting in v5.20, Perl supports UTF-8 locales for <code>LC_CTYPE</code>,
but
otherwise Perl only supports single-byte locales, such as the ISO 8859
series. This means that wide character locales, for example for Asian
-languages, are not supported. The UTF-8 locale support is actually a
+languages, are not well-supported. The UTF-8 locale support is actually a
superset of POSIX locales, because it is really full Unicode behavior
as if no locale were in effect at all (except for tainting; see
<a href="#perllocale-SECURITY">SECURITY</a>). POSIX locales, even UTF-8 ones,
@@ -55902,7 +55974,11 @@
used as a workaround for this (see <a
href="#perllocale-Unicode-and-UTF_002d8">Unicode and UTF-8</a>).
</p>
<p>Note that there are quite a few things that are unaffected by the
-current locale. All the escape sequences for particular characters,
+current locale. Any literal character is the native character for the
+given platform. Hence ’A’ means the character at code point 65 on
ASCII
+platforms, and 193 on EBCDIC. That may or may not be an ’A’ in the
+current locale, if that locale even has an ’A’.
+Similarly, all the escape sequences for particular characters,
<code>\n</code> for example, always mean the platform’s native one.
This means,
for example, that <code>\N</code> in regular expressions (every character
but new-line) works on the platform character set.
@@ -56037,7 +56113,7 @@
<ul>
<li> Regular expression checks for safe file names or mail addresses using
<code>\w</code> may be spoofed by an <code>LC_CTYPE</code> locale that claims
that
-characters such as ">" and "|" are alphanumeric.
+characters such as <code>">"</code> and
<code>"|"</code> are alphanumeric.
</li><li> String interpolation with case-mapping, as in, say, <code>$dest =
"C:\U$name.$ext"</code>, may produce dangerous results if a bogus
<code>LC_CTYPE</code>
@@ -56575,9 +56651,10 @@
properly under <code>LC_CTYPE</code>. To see if a character is a particular
type
under a locale, Perl uses the functions like <code>isalnum()</code>. Your C
library may not work for UTF-8 locales with those functions, instead
-only working under the newer wide library functions like
<code>iswalnum()</code>.
-However, they are treated like single-byte locales, and will have the
-restrictions described below.
+only working under the newer wide library functions like
<code>iswalnum()</code>,
+which Perl does not use.
+These multi-byte locales are treated like single-byte locales, and will
+have the restrictions described below.
</p>
<p>For single-byte locales,
Perl generally takes the tack to use locale rules on code points that can fit
@@ -56597,7 +56674,7 @@
issue occurs with <code>\N{...}</code>. Prior to v5.20, It is therefore a bad
idea to use <code>\p{}</code> or
<code>\N{}</code> under plain <code>use locale</code>–<em>unless</em>
you can guarantee that the
-locale will be a ISO8859-1. Use POSIX character classes instead.
+locale will be ISO8859-1. Use POSIX character classes instead.
</p>
<p>Another problem with this approach is that operations that cross the
single byte/multiple byte boundary are not well-defined, and so are
@@ -56649,9 +56726,9 @@
Pre-v5.12, it was somewhat haphazard; in v5.12 it was applied fairly
consistently to regular expression matching except for bracketed
character classes; in v5.14 it was extended to all regex matches; and in
-v5.16 to the casing operations such as <code>"\L"</code> and
<code>uc()</code>. For
-collation, in all releases, the system’s <code>strxfrm()</code> function
is called,
-and whatever it does is what you get.
+v5.16 to the casing operations such as <code>\L</code> and <code>uc()</code>.
For
+collation, in all releases so far, the system’s <code>strxfrm()</code>
function is
+called, and whatever it does is what you get.
</p>
<hr>
<a name="perllocale-BUGS"></a>
@@ -57234,28 +57311,60 @@
<h3 class="section">40.2 DESCRIPTION</h3>
<table class="menu" border="0" cellspacing="0">
-<tr><td align="left" valign="top">• <a href="#perlmod-Packages"
accesskey="1">perlmod Packages</a>:</td><td> </td><td align="left"
valign="top">
+<tr><td align="left" valign="top">• <a
href="#perlmod-Is-this-the-document-you-were-after_003f" accesskey="1">perlmod
Is this the document you were after?</a>:</td><td> </td><td
align="left" valign="top">
+</td></tr>
+<tr><td align="left" valign="top">• <a href="#perlmod-Packages"
accesskey="2">perlmod Packages</a>:</td><td> </td><td align="left"
valign="top">
</td></tr>
-<tr><td align="left" valign="top">• <a href="#perlmod-Symbol-Tables"
accesskey="2">perlmod Symbol Tables</a>:</td><td> </td><td
align="left" valign="top">
+<tr><td align="left" valign="top">• <a href="#perlmod-Symbol-Tables"
accesskey="3">perlmod Symbol Tables</a>:</td><td> </td><td
align="left" valign="top">
</td></tr>
-<tr><td align="left" valign="top">• <a
href="#perlmod-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END"
accesskey="3">perlmod BEGIN, UNITCHECK, CHECK, INIT and
END</a>:</td><td> </td><td align="left" valign="top">
+<tr><td align="left" valign="top">• <a
href="#perlmod-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END"
accesskey="4">perlmod BEGIN, UNITCHECK, CHECK, INIT and
END</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
-<tr><td align="left" valign="top">• <a href="#perlmod-Perl-Classes"
accesskey="4">perlmod Perl Classes</a>:</td><td> </td><td
align="left" valign="top">
+<tr><td align="left" valign="top">• <a href="#perlmod-Perl-Classes"
accesskey="5">perlmod Perl Classes</a>:</td><td> </td><td
align="left" valign="top">
</td></tr>
-<tr><td align="left" valign="top">• <a href="#perlmod-Perl-Modules"
accesskey="5">perlmod Perl Modules</a>:</td><td> </td><td
align="left" valign="top">
+<tr><td align="left" valign="top">• <a href="#perlmod-Perl-Modules"
accesskey="6">perlmod Perl Modules</a>:</td><td> </td><td
align="left" valign="top">
</td></tr>
-<tr><td align="left" valign="top">• <a
href="#perlmod-Making-your-module-threadsafe" accesskey="6">perlmod Making your
module threadsafe</a>:</td><td> </td><td align="left" valign="top">
+<tr><td align="left" valign="top">• <a
href="#perlmod-Making-your-module-threadsafe" accesskey="7">perlmod Making your
module threadsafe</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
+<a name="perlmod-Is-this-the-document-you-were-after_003f"></a>
+<div class="header">
+<p>
+Next: <a href="#perlmod-Packages" accesskey="n" rel="next">perlmod
Packages</a>, Up: <a href="#perlmod-DESCRIPTION" accesskey="u" rel="up">perlmod
DESCRIPTION</a> [<a href="#SEC_Contents" title="Table of contents"
rel="contents">Contents</a>]</p>
+</div>
+<a name="Is-this-the-document-you-were-after_003f"></a>
+<h4 class="subsection">40.2.1 Is this the document you were after?</h4>
+
+<p>There are other documents which might contain the information that
you’re
+looking for:
+</p>
+<dl compact="compact">
+<dt>This doc</dt>
+<dd><a name="perlmod-This-doc"></a>
+<p>Perl’s packages, namespaces, and some info on classes.
+</p>
+</dd>
+<dt><a href="#perlnewmod-NAME">perlnewmod NAME</a></dt>
+<dd><a name="perlmod-perlnewmod-NAME"></a>
+<p>Tutorial on making a new module.
+</p>
+</dd>
+<dt><a href="#perlmodstyle-NAME">perlmodstyle NAME</a></dt>
+<dd><a name="perlmod-perlmodstyle-NAME"></a>
+<p>Best practices for making a new module.
+</p>
+</dd>
+</dl>
+
+<hr>
<a name="perlmod-Packages"></a>
<div class="header">
<p>
-Next: <a href="#perlmod-Symbol-Tables" accesskey="n" rel="next">perlmod Symbol
Tables</a>, Up: <a href="#perlmod-DESCRIPTION" accesskey="u" rel="up">perlmod
DESCRIPTION</a> [<a href="#SEC_Contents" title="Table of contents"
rel="contents">Contents</a>]</p>
+Next: <a href="#perlmod-Symbol-Tables" accesskey="n" rel="next">perlmod Symbol
Tables</a>, Previous: <a
href="#perlmod-Is-this-the-document-you-were-after_003f" accesskey="p"
rel="prev">perlmod Is this the document you were after?</a>, Up: <a
href="#perlmod-DESCRIPTION" accesskey="u" rel="up">perlmod DESCRIPTION</a>
[<a href="#SEC_Contents" title="Table of contents"
rel="contents">Contents</a>]</p>
</div>
<a name="Packages"></a>
-<h4 class="subsection">40.2.1 Packages</h4>
+<h4 class="subsection">40.2.2 Packages</h4>
<p>Perl provides a mechanism for alternative namespaces to protect
packages from stomping on each other’s variables. In fact, there’s
@@ -57340,7 +57449,7 @@
Next: <a href="#perlmod-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END"
accesskey="n" rel="next">perlmod BEGIN, UNITCHECK, CHECK, INIT and END</a>,
Previous: <a href="#perlmod-Packages" accesskey="p" rel="prev">perlmod
Packages</a>, Up: <a href="#perlmod-DESCRIPTION" accesskey="u" rel="up">perlmod
DESCRIPTION</a> [<a href="#SEC_Contents" title="Table of contents"
rel="contents">Contents</a>]</p>
</div>
<a name="Symbol-Tables"></a>
-<h4 class="subsection">40.2.2 Symbol Tables</h4>
+<h4 class="subsection">40.2.3 Symbol Tables</h4>
<p>The symbol table for a package happens to be stored in the hash of that
name with two colons appended. The main symbol table’s name is thus
@@ -57514,7 +57623,7 @@
Next: <a href="#perlmod-Perl-Classes" accesskey="n" rel="next">perlmod Perl
Classes</a>, Previous: <a href="#perlmod-Symbol-Tables" accesskey="p"
rel="prev">perlmod Symbol Tables</a>, Up: <a href="#perlmod-DESCRIPTION"
accesskey="u" rel="up">perlmod DESCRIPTION</a> [<a href="#SEC_Contents"
title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END"></a>
-<h4 class="subsection">40.2.3 BEGIN, UNITCHECK, CHECK, INIT and END</h4>
+<h4 class="subsection">40.2.4 BEGIN, UNITCHECK, CHECK, INIT and END</h4>
<p>Five specially named code blocks are executed at the beginning and at
the end of a running Perl program. These are the <code>BEGIN</code>,
@@ -57638,7 +57747,7 @@
Next: <a href="#perlmod-Perl-Modules" accesskey="n" rel="next">perlmod Perl
Modules</a>, Previous: <a
href="#perlmod-BEGIN_002c-UNITCHECK_002c-CHECK_002c-INIT-and-END" accesskey="p"
rel="prev">perlmod BEGIN, UNITCHECK, CHECK, INIT and END</a>, Up: <a
href="#perlmod-DESCRIPTION" accesskey="u" rel="up">perlmod DESCRIPTION</a>
[<a href="#SEC_Contents" title="Table of contents"
rel="contents">Contents</a>]</p>
</div>
<a name="Perl-Classes"></a>
-<h4 class="subsection">40.2.4 Perl Classes</h4>
+<h4 class="subsection">40.2.5 Perl Classes</h4>
<p>There is no special class syntax in Perl, but a package may act
as a class if it provides subroutines to act as methods. Such a
@@ -57655,7 +57764,7 @@
Next: <a href="#perlmod-Making-your-module-threadsafe" accesskey="n"
rel="next">perlmod Making your module threadsafe</a>, Previous: <a
href="#perlmod-Perl-Classes" accesskey="p" rel="prev">perlmod Perl Classes</a>,
Up: <a href="#perlmod-DESCRIPTION" accesskey="u" rel="up">perlmod
DESCRIPTION</a> [<a href="#SEC_Contents" title="Table of contents"
rel="contents">Contents</a>]</p>
</div>
<a name="Perl-Modules"></a>
-<h4 class="subsection">40.2.5 Perl Modules</h4>
+<h4 class="subsection">40.2.6 Perl Modules</h4>
<p>A module is just a set of related functions in a library file, i.e.,
a Perl package with the same name as the file. It is specifically
@@ -57818,7 +57927,7 @@
Previous: <a href="#perlmod-Perl-Modules" accesskey="p" rel="prev">perlmod
Perl Modules</a>, Up: <a href="#perlmod-DESCRIPTION" accesskey="u"
rel="up">perlmod DESCRIPTION</a> [<a href="#SEC_Contents" title="Table
of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Making-your-module-threadsafe"></a>
-<h4 class="subsection">40.2.6 Making your module threadsafe</h4>
+<h4 class="subsection">40.2.7 Making your module threadsafe</h4>
<p>Perl supports a type of threads called interpreter threads (ithreads).
These threads can be used explicitly and implicitly.
@@ -58624,7 +58733,9 @@
good reason.
</p>
<p>Good places to look for pre-existing modules include
-http://search.cpan.org/ and asking on address@hidden
+<a href="http://search.cpan.org/">http://search.cpan.org/</a> and <a
href="https://metacpan.org">https://metacpan.org</a>
+and asking on <code>address@hidden</code>
+(<a
href="http://lists.perl.org/list/module-authors.html">http://lists.perl.org/list/module-authors.html</a>).
</p>
<p>If an existing module <strong>almost</strong> does what you want, consider
writing a
patch, writing a subclass, or otherwise extending the existing module
@@ -59139,9 +59250,11 @@
regular version number followed by at least 2 digits, eg. 1.20_01. If
you do this, the following idiom is recommended:
</p>
-<pre class="verbatim"> $VERSION = "1.12_01";
- $XS_VERSION = $VERSION; # only needed if you have XS code
- $VERSION = eval $VERSION;
+<pre class="verbatim"> our $VERSION = "1.12_01"; # so CPAN
distribution will have
+ # right filename
+ our $XS_VERSION = $VERSION; # only needed if you have XS code
+ $VERSION = eval $VERSION; # so "use Module 0.002" won't warn on
+ # underscore
</pre>
<p>With that trick MakeMaker will only read the first line and thus read
the underscore, while the perl interpreter will evaluate the $VERSION
@@ -59153,6 +59266,13 @@
incrementing the number. Even a one-word documentation patch should
result in a change in version at the sub-minor level.
</p>
+<p>Once picked, it is important to stick to your version scheme, without
+reducing the number of digits. This is because "downstream"
packagers,
+such as the FreeBSD ports system, interpret the version numbers in
+various ways. If you change the number of digits in your version scheme,
+you can confuse these systems so they get the versions of your module
+out of order, which is obviously bad.
+</p>
<hr>
<a name="perlmodstyle-Pre_002drequisites"></a>
<div class="header">
@@ -59201,7 +59321,8 @@
For Module::Build you would use the <code>make test</code> equivalent
<code>perl Build test</code>.
</p>
<p>The importance of these tests is proportional to the alleged stability of a
-module. A module which purports to be stable or which hopes to achieve wide
+module. A module which purports to be
+stable or which hopes to achieve wide
use should adhere to as strict a testing regime as possible.
</p>
<p>Useful modules to help you write tests (with minimum impact on your
@@ -59223,8 +59344,9 @@
more platform independent Module::Build, allowing modules to be installed in a
consistent manner.
When using ExtUtils::MakeMaker, you can use "make dist" to create
your
-package. Tools exist to help you to build your module in a MakeMaker-friendly
-style. These include ExtUtils::ModuleMaker and h2xs. See also <a
href="#perlnewmod-NAME">perlnewmod NAME</a>.
+package. Tools exist to help you to build your module in a
+MakeMaker-friendly style. These include ExtUtils::ModuleMaker and h2xs.
+See also <a href="#perlnewmod-NAME">perlnewmod NAME</a>.
</p>
<hr>
<a name="perlmodstyle-Licensing"></a>
@@ -59602,6 +59724,9 @@
packaging up the solution into a module and uploading it to CPAN so that
others can benefit.
</p>
+<p>You should also take a look at <a href="#perlmodstyle-NAME">perlmodstyle
NAME</a> for best practices in
+making a module.
+</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#perlnewmod-Warning"
accesskey="1">perlnewmod Warning</a>:</td><td> </td><td align="left"
valign="top">
</td></tr>
@@ -62584,15 +62709,15 @@
<h3 class="section">48.2 DESCRIPTION</h3>
<p>In Perl, the operator determines what operation is performed,
-independent of the type of the operands. For example <code>$a + $b</code>
-is always a numeric addition, and if <code>$a</code> or <code>$b</code> do not
contain
+independent of the type of the operands. For example <code>$x + $y</code>
+is always a numeric addition, and if <code>$x</code> or <code>$y</code> do not
contain
numbers, an attempt is made to convert them to numbers first.
</p>
<p>This is in contrast to many other dynamic languages, where the
operation is determined by the type of the first argument. It also
means that Perl has two versions of some operators, one for numeric
-and one for string comparison. For example <code>$a == $b</code> compares
-two numbers for equality, and <code>$a eq $b</code> compares two strings.
+and one for string comparison. For example <code>$x == $y</code> compares
+two numbers for equality, and <code>$x eq $y</code> compares two strings.
</p>
<p>There are a few exceptions though: <code>x</code> can be either string
repetition or list repetition, depending on the type of the left
@@ -62967,7 +63092,8 @@
</p>
<p>If the right argument is an expression rather than a search pattern,
substitution, or transliteration, it is interpreted as a search pattern at run
-time. Note that this means that its contents will be interpolated twice, so
+time. Note that this means that its
+contents will be interpolated twice, so
</p>
<pre class="verbatim"> '\\' =~ q'\\';
</pre>
@@ -62996,21 +63122,21 @@
<p>Binary "%" is the modulo operator, which computes the division
remainder of its first argument with respect to its second argument.
Given integer
-operands <code>$a</code> and <code>$b</code>: If <code>$b</code> is positive,
then <code>$a % $b</code> is
-<code>$a</code> minus the largest multiple of <code>$b</code> less than or
equal to
-<code>$a</code>. If <code>$b</code> is negative, then <code>$a % $b</code> is
<code>$a</code> minus the
-smallest multiple of <code>$b</code> that is not less than <code>$a</code>
(that is, the
+operands <code>$m</code> and <code>$n</code>: If <code>$n</code> is positive,
then <code>$m % $n</code> is
+<code>$m</code> minus the largest multiple of <code>$n</code> less than or
equal to
+<code>$m</code>. If <code>$n</code> is negative, then <code>$m % $n</code> is
<code>$m</code> minus the
+smallest multiple of <code>$n</code> that is not less than <code>$m</code>
(that is, the
result will be less than or equal to zero). If the operands
-<code>$a</code> and <code>$b</code> are floating point values and the absolute
value of
-<code>$b</code> (that is <code>abs($b)</code>) is less than <code>(UV_MAX +
1)</code>, only
-the integer portion of <code>$a</code> and <code>$b</code> will be used in the
operation
+<code>$m</code> and <code>$n</code> are floating point values and the absolute
value of
+<code>$n</code> (that is <code>abs($n)</code>) is less than <code>(UV_MAX +
1)</code>, only
+the integer portion of <code>$m</code> and <code>$n</code> will be used in the
operation
(Note: here <code>UV_MAX</code> means the maximum of the unsigned integer
type).
-If the absolute value of the right operand (<code>abs($b)</code>) is greater
than
+If the absolute value of the right operand (<code>abs($n)</code>) is greater
than
or equal to <code>(UV_MAX + 1)</code>, "%" computes the
floating-point remainder
-<code>$r</code> in the equation <code>($r = $a - $i*$b)</code> where
<code>$i</code> is a certain
+<code>$r</code> in the equation <code>($r = $m - $i*$n)</code> where
<code>$i</code> is a certain
integer that makes <code>$r</code> have the same sign as the right operand
-<code>$b</code> (<strong>not</strong> as the left operand <code>$a</code> like
C function <code>fmod()</code>)
-and the absolute value less than that of <code>$b</code>.
+<code>$n</code> (<strong>not</strong> as the left operand <code>$m</code> like
C function <code>fmod()</code>)
+and the absolute value less than that of <code>$n</code>.
Note that when <code>use integer</code> is in scope, "%" gives you
direct access
to the modulo operator as implemented by your C compiler. This
operator is not as well defined for negative operands, but it will
@@ -63192,8 +63318,8 @@
support NaNs then NaN is just a string with numeric value 0.
>>
</p>
-<pre class="verbatim"> $ perl -le '$a = "NaN"; print "No NaN
support here" if $a == $a'
- $ perl -le '$a = "NaN"; print "NaN support here" if $a
!= $a'
+<pre class="verbatim"> $ perl -le '$x = "NaN"; print "No NaN
support here" if $x == $x'
+ $ perl -le '$x = "NaN"; print "NaN support here" if $x
!= $x'
</pre>
<p>(Note that the <a href="bigint.html#Top">(bigint)</a>, <a
href="bigrat.html#Top">(bigrat)</a>, and <a href="bignum.html#Top">(bignum)</a>
pragmas all
support "NaN".)
@@ -63495,7 +63621,8 @@
"fred" ~~ $object
</pre>
<p>However, you can change the way an object is smartmatched by overloading
-the <code>~~</code> operator. This is allowed to extend the usual smartmatch
semantics.
+the <code>~~</code> operator. This is allowed to
+extend the usual smartmatch semantics.
For objects that do have an <code>~~</code> overload, see <a
href="overload.html#Top">(overload)</a>.
</p>
<p>Using an object as the left operand is allowed, although not very useful.
@@ -63610,13 +63737,14 @@
to its C-style or. In fact, it’s exactly the same as <code>||</code>,
except that it
tests the left hand side’s definedness instead of its truth. Thus,
<code>EXPR1 // EXPR2</code> returns the value of <code>EXPR1</code> if
it’s defined,
-otherwise, the value of <code>EXPR2</code> is returned. (<code>EXPR1</code> is
evaluated
-in scalar context, <code>EXPR2</code> in the context of <code>//</code>
itself). Usually,
+otherwise, the value of <code>EXPR2</code> is returned.
+(<code>EXPR1</code> is evaluated in scalar context, <code>EXPR2</code>
+in the context of <code>//</code> itself). Usually,
this is the same result as <code>defined(EXPR1) ? EXPR1 : EXPR2</code> (except
that
the ternary-operator form can be used as a lvalue, while <code>EXPR1 //
EXPR2</code>
cannot). This is very useful for
providing default values for variables. If you actually want to test if
-at least one of <code>$a</code> and <code>$b</code> is defined, use
<code>defined($a // $b)</code>.
+at least one of <code>$x</code> and <code>$y</code> is defined, use
<code>defined($x // $y)</code>.
</p>
<p>The <code>||</code>, <code>//</code> and <code>&&</code> operators
return the last value evaluated
(unlike C’s <code>||</code> and <code>&&</code>, which return 0
or 1). Thus, a reasonably
@@ -63840,31 +63968,31 @@
<p>Scalar or list context propagates downward into the 2nd
or 3rd argument, whichever is selected.
</p>
-<pre class="verbatim"> $a = $ok ? $b : $c; # get a scalar
- @a = $ok ? @b : @c; # get an array
- $a = $ok ? @b : @c; # oops, that's just a count!
+<pre class="verbatim"> $x = $ok ? $y : $z; # get a scalar
+ @x = $ok ? @y : @z; # get an array
+ $x = $ok ? @y : @z; # oops, that's just a count!
</pre>
<p>The operator may be assigned to if both the 2nd and 3rd arguments are
legal lvalues (meaning that you can assign to them):
</p>
-<pre class="verbatim"> ($a_or_b ? $a : $b) = $c;
+<pre class="verbatim"> ($x_or_y ? $x : $y) = $z;
</pre>
<p>Because this operator produces an assignable result, using assignments
without parentheses will get you in trouble. For example, this:
</p>
-<pre class="verbatim"> $a % 2 ? $a += 10 : $a += 2
+<pre class="verbatim"> $x % 2 ? $x += 10 : $x += 2
</pre>
<p>Really means this:
</p>
-<pre class="verbatim"> (($a % 2) ? ($a += 10) : $a) += 2
+<pre class="verbatim"> (($x % 2) ? ($x += 10) : $x) += 2
</pre>
<p>Rather than this:
</p>
-<pre class="verbatim"> ($a % 2) ? ($a += 10) : ($a += 2)
+<pre class="verbatim"> ($x % 2) ? ($x += 10) : ($x += 2)
</pre>
<p>That should probably be written more simply as:
</p>
-<pre class="verbatim"> $a += ($a % 2) ? 10 : 2;
+<pre class="verbatim"> $x += ($x % 2) ? 10 : 2;
</pre>
<hr>
<a name="perlop-Assignment-Operators"></a>
@@ -63881,11 +64009,11 @@
</p>
<p>Assignment operators work as in C. That is,
</p>
-<pre class="verbatim"> $a += 2;
+<pre class="verbatim"> $x += 2;
</pre>
<p>is equivalent to
</p>
-<pre class="verbatim"> $a = $a + 2;
+<pre class="verbatim"> $x = $x + 2;
</pre>
<p>although without duplicating any side effects that dereferencing the lvalue
might trigger, such as from tie(). Other assignment operators work similarly.
@@ -63913,12 +64041,12 @@
</pre>
<p>Likewise,
</p>
-<pre class="verbatim"> ($a += 2) *= 3;
+<pre class="verbatim"> ($x += 2) *= 3;
</pre>
<p>is equivalent to
</p>
-<pre class="verbatim"> $a += 2;
- $a *= 3;
+<pre class="verbatim"> $x += 2;
+ $x *= 3;
</pre>
<p>Similarly, a list assignment in list context produces the list of
lvalues assigned to, and a list assignment in scalar context returns
@@ -64055,9 +64183,9 @@
be careful to avoid using it as replacement for the <code>||</code> operator.
It usually works out better for flow control than in assignments:
</p>
-<pre class="verbatim"> $a = $b or $c; # bug: this is wrong
- ($a = $b) or $c; # really means this
- $a = $b || $c; # better written this way
+<pre class="verbatim"> $x = $y or $z; # bug: this is wrong
+ ($x = $y) or $z; # really means this
+ $x = $y || $z; # better written this way
</pre>
<p>However, when it’s a list-context assignment and you’re trying
to use
<code>||</code> for control flow, you probably need "or" so that the
assignment
@@ -64148,7 +64276,7 @@
</pre>
<p>Note, however, that this does not always work for quoting Perl code:
</p>
-<pre class="verbatim"> $s = q{ if($a eq "}") ... }; # WRONG
+<pre class="verbatim"> $s = q{ if($x eq "}") ... }; # WRONG
</pre>
<p>is a syntax error. The <code>Text::Balanced</code> module (standard as of
v5.8,
and from CPAN before then) is able to do this properly.
@@ -64604,7 +64732,7 @@
<p>Note that it’s possible to confuse Perl into thinking <code>//</code>
(the empty
regex) is really <code>//</code> (the defined-or operator). Perl is usually
pretty
good about this, but some pathological cases might trigger this, such as
-<code>$a///</code> (is that <code>($a) / (//)</code> or <code>$a // /</code>?)
and <code>print $fh //</code>
+<code>$x///</code> (is that <code>($x) / (//)</code> or <code>$x // /</code>?)
and <code>print $fh //</code>
(<code>print $fh(//</code> or <code>print($fh //</code>?). In all of these
examples, Perl
will assume you meant defined-or. If you meant the empty regex, just
use parentheses or spaces to disambiguate, or even prefix the empty
@@ -64891,7 +65019,7 @@
s/^=(\w+)/pod($1)/ge; # use function call
$_ = 'abc123xyz';
- $a = s/abc/def/r; # $a is 'def123xyz' and
+ $x = s/abc/def/r; # $x is 'def123xyz' and
# $_ remains 'abc123xyz'.
# expand variables in $_, but dynamics only, using
@@ -65414,7 +65542,7 @@
If the starting delimiter is an unpaired character like <code>/</code> or a
closing
punctuation, the ending delimiter is same as the starting delimiter.
Therefore a <code>/</code> terminates a <code>qq//</code> construct, while a
<code>]</code> terminates
-<code>qq[]</code> and <code>qq]]</code> constructs.
+both <code>qq[]</code> and <code>qq]]</code> constructs.
</p>
<p>When searching for single-character delimiters, escaped delimiters
and <code>\\</code> are skipped. For example, while searching for terminating
<code>/</code>,
@@ -65430,13 +65558,14 @@
</p>
<p>For constructs with three-part delimiters (<code>s///</code>,
<code>y///</code>, and
<code>tr///</code>), the search is repeated once more.
-If the first delimiter is not an opening punctuation, three delimiters must
-be same such as <code>s!!!</code> and <code>tr)))</code>, in which case the
second delimiter
+If the first delimiter is not an opening punctuation, the three delimiters must
+be the same, such as <code>s!!!</code> and <code>tr)))</code>,
+in which case the second delimiter
terminates the left part and starts the right part at once.
If the left part is delimited by bracketing punctuation (that is
<code>()</code>,
<code>[]</code>, <code>{}</code>, or <code><></code>), the right part
needs another pair of
delimiters such as <code>s(){}</code> and <code>tr[]//</code>. In these
cases, whitespace
-and comments are allowed between both parts, though the comment must follow
+and comments are allowed between the two parts, though the comment must follow
at least one whitespace character; otherwise a character expected as the
start of the comment may be regarded as the starting delimiter of the right
part.
</p>
@@ -65538,13 +65667,13 @@
</p>
<p>Note also that the interpolation code needs to make a decision on
where the interpolated scalar ends. For instance, whether
-<code>"a $b -> {c}"</code> really means:
+<code>"a $x -> {c}"</code> really means:
</p>
-<pre class="verbatim"> "a " . $b . " -> {c}";
+<pre class="verbatim"> "a " . $x . " -> {c}";
</pre>
<p>or:
</p>
-<pre class="verbatim"> "a " . $b -> {c};
+<pre class="verbatim"> "a " . $x -> {c};
</pre>
<p>Most of the time, the longest possible text that does not include
spaces between components and which contains matching braces or
@@ -66118,15 +66247,16 @@
</p>
<pre class="verbatim"> use 5.010;
use bigrat;
- $a = 3/22;
- $b = 4/6;
- say "a/b is ", $a/$b;
- say "a*b is ", $a*$b;
- a/b is 9/44
- a*b is 1/11
+ $x = 3/22;
+ $y = 4/6;
+ say "x/y is ", $x/$y;
+ say "x*y is ", $x*$y;
+ x/y is 9/44
+ x*y is 1/11
</pre>
<p>Several modules let you calculate with (bound only by memory and CPU time)
-unlimited or fixed precision. There are also some non-standard modules that
+unlimited or fixed precision. There
+are also some non-standard modules that
provide faster implementations via external C libraries.
</p>
<p>Here is a short, but incomplete summary:
@@ -72632,9 +72762,9 @@
the Perl community should expect from Perl’s developers:
</p>
<ul>
-<li> We "officially" support the two most recent stable release
series. 5.12.x
-and earlier are now out of support. As of the release of 5.18.0, we will
-"officially" end support for Perl 5.14.x, other than providing
security
+<li> We "officially" support the two most recent stable release
series. 5.14.x
+and earlier are now out of support. As of the release of 5.20.0, we will
+"officially" end support for Perl 5.16.x, other than providing
security
updates as described below.
</li><li> To the best of our ability, we will attempt to fix critical issues
@@ -72760,6 +72890,14 @@
features, you should contact the perl5-porters mailinglist if you find
an experimental feature useful and want to help shape its future.
</p>
+<p>Experimental features must be experimental in two stable releases before
being
+marked non-experimental. Experimental features will only have their
+experimental status revoked when they no longer have any design-changing bugs
+open against them and when they have remained unchanged in behavior for the
+entire length of a development cycle. In other words, a feature present in
+v5.20.0 may be marked no longer experimental in v5.22.0 if and only if its
+behavior is unchanged throughout all of v5.21.
+</p>
</dd>
<dt>deprecated</dt>
<dd><a name="perlpolicy-deprecated"></a>
@@ -72828,7 +72966,8 @@
</li><li> Patches that add new warnings or errors or deprecate features
are not acceptable.
-</li><li> Patches that fix crashing bugs that do not otherwise change
Perl’s
+</li><li> Patches that fix crashing bugs, assertion failures and
+memory corruption that do not otherwise change Perl’s
functionality or negatively impact performance are acceptable.
</li><li> Patches that fix CVEs or security issues are acceptable, but should
@@ -73083,10 +73222,10 @@
is not acceptable.
</p>
<p>Unacceptable behavior will result in a public and clearly identified
warning.
-Repeated unacceptable behavior will result in removal from the mailing list.
-The first removal is for one month. Subsequent removals will double in length.
-After six months with no warning, a user’s ban length is reset.
Removals, like
-warnings, are public.
+Repeated unacceptable behavior will result in removal from the mailing list and
+revocation of rights to update rt.perl.org. The first removal is for one
+month. Subsequent removals will double in length. After six months with no
+warning, a user’s ban length is reset. Removals, like warnings, are
public.
</p>
<p>The list of moderators will be public knowledge. At present, it is:
Aaron Crane, Andy Dougherty, Ricardo Signes, Steffen Müller.
@@ -82325,9 +82464,9 @@
</dd>
<dt>[6]</dt>
<dd><a name="perlrecharclass-_005b6_005d"></a>
-<p><code>\p{SpacePerl}</code> and <code>\p{Space}</code> match identically
starting with Perl
+<p><code>\p{XPerlSpace}</code> and <code>\p{Space}</code> match identically
starting with Perl
v5.18. In earlier versions, these differ only in that in non-locale
-matching, <code>\p{SpacePerl}</code> does not match the vertical tab,
<code>\cK</code>.
+matching, <code>\p{XPerlSpace}</code> does not match the vertical tab,
<code>\cK</code>.
Same for the two ASCII-only range forms.
</p>
</dd>
@@ -91726,7 +91865,7 @@
<pre class="verbatim"> perl -Mlib=/foo program
</pre>
<p>The benefit of using <code>-Mlib=/foo</code> over <code>-I/foo</code>, is
that the former
-will automagically remove any duplicated directories, while the later
+will automagically remove any duplicated directories, while the latter
will not.
</p>
<p>Note that if a tainted string is added to <code>@INC</code>, the following
@@ -91766,7 +91905,8 @@
care whether they use tainted values. Make judicious use of the file
tests in dealing with any user-supplied filenames. When possible, do
opens and such <strong>after</strong> properly dropping any special user (or
group!)
-privileges. Perl doesn’t prevent you from opening tainted filenames for
reading,
+privileges. Perl doesn’t prevent you from
+opening tainted filenames for reading,
so be careful what you print out. The tainting mechanism is intended to
prevent stupid mistakes, not to remove the need for thought.
</p>
@@ -92006,8 +92146,9 @@
<dt>Bucket Order Perturbance</dt>
<dd><a name="perlsec-Bucket-Order-Perturbance"></a>
<p>When items collide into a given hash bucket the order they are stored in
-the chain is no longer predictable in Perl 5.18. This has the intention
-to make it harder to observe a collisions. This behavior can be overridden by
using
+the chain is no longer predictable in Perl 5.18. This
+has the intention to make it harder to observe a
+collision. This behavior can be overridden by using
the PERL_PERTURB_KEYS environment variable, see <a
href="#perlrun-PERL_005fPERTURB_005fKEYS">perlrun PERL_PERTURB_KEYS</a>.
</p>
</dd>
@@ -93816,7 +93957,8 @@
$val
}
</pre>
-<p>except that for those the <code>local</code> is scoped to the
<code>do</code> block. Slices are
+<p>except that for those the <code>local</code> is
+scoped to the <code>do</code> block. Slices are
also accepted.
</p>
<pre class="verbatim"> my %hash = (
@@ -93932,6 +94074,9 @@
baz(); # recursive call
}
</pre>
+<p>It is a known bug that lexical subroutines cannot be used as the
<code>SUBNAME</code>
+argument to <code>sort</code>. This will be fixed in a future version of Perl.
+</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a
href="#perlsub-state-sub-vs-my-sub" accesskey="1">perlsub <code>state
sub</code> vs <code>my sub</code></a>:</td><td> </td><td
align="left" valign="top">
</td></tr>
@@ -95779,18 +95924,15 @@
</p>
<pre class="verbatim"> @transformed = map { ... } @input; # syntax error
</pre>
-<p>You can use a <code>;</code> inside your block to denote that the <code>{
... }</code> is a
-block and not a hash reference constructor. Now the ellipsis works:
+<p>Inside your block, you can use a <code>;</code> before the ellipsis to
denote that the
+<code>{ ... }</code> is a block and not a hash reference constructor. Now the
ellipsis
+works:
</p>
-<pre class="verbatim"> @transformed = map {; ... } @input; # ; disambiguates
-
- @transformed = map { ...; } @input; # ; disambiguates
+<pre class="verbatim"> @transformed = map {; ... } @input; # ';'
disambiguates
</pre>
<p>Note: Some folks colloquially refer to this bit of punctuation as a
"yada-yada" or "triple-dot", but its true name
-is actually an ellipsis. Perl does not yet
-accept the Unicode version, U+2026 HORIZONTAL ELLIPSIS, as an alias for
-<code>...</code>, but someday it may.
+is actually an ellipsis.
</p>
<hr>
<a name="perlsyn-PODs_003a-Embedded-Documentation"></a>
@@ -96777,10 +96919,10 @@
sleep(15); # Let thread run for awhile
sub sub1 {
- $a = 0;
+ my $count = 0;
while (1) {
- $a++;
- print("\$a is $a\n");
+ $count++;
+ print("\$count is $count\n");
sleep(1);
}
}
@@ -96934,22 +97076,22 @@
<pre class="verbatim"> use threads;
use threads::shared;
- my $a :shared = 1;
+ my $x :shared = 1;
my $thr1 = threads->create(\&sub1);
my $thr2 = threads->create(\&sub2);
$thr1->join();
$thr2->join();
- print("$a\n");
+ print("$x\n");
- sub sub1 { my $foo = $a; $a = $foo + 1; }
- sub sub2 { my $bar = $a; $a = $bar + 1; }
+ sub sub1 { my $foo = $x; $x = $foo + 1; }
+ sub sub2 { my $bar = $x; $x = $bar + 1; }
</pre>
-<p>What do you think <code>$a</code> will be? The answer, unfortunately, is
<em>it
-depends</em>. Both <code>sub1()</code> and <code>sub2()</code> access the
global variable <code>$a</code>, once
+<p>What do you think <code>$x</code> will be? The answer, unfortunately, is
<em>it
+depends</em>. Both <code>sub1()</code> and <code>sub2()</code> access the
global variable <code>$x</code>, once
to read and once to write. Depending on factors ranging from your
thread implementation’s scheduling algorithm to the phase of the moon,
-<code>$a</code> can be 2 or 3.
+<code>$x</code> can be 2 or 3.
</p>
<p>Race conditions are caused by unsynchronized access to shared
data. Without explicit synchronization, there’s no way to be sure that
@@ -96958,19 +97100,19 @@
possibility of error:
</p>
<pre class="verbatim"> use threads;
- my $a :shared = 2;
- my $b :shared;
- my $c :shared;
- my $thr1 = threads->create(sub { $b = $a; $a = $b + 1; });
- my $thr2 = threads->create(sub { $c = $a; $a = $c + 1; });
+ my $x :shared = 2;
+ my $y :shared;
+ my $z :shared;
+ my $thr1 = threads->create(sub { $y = $x; $x = $y + 1; });
+ my $thr2 = threads->create(sub { $z = $x; $x = $z + 1; });
$thr1->join();
$thr2->join();
</pre>
-<p>Two threads both access <code>$a</code>. Each thread can potentially be
interrupted
-at any point, or be executed in any order. At the end, <code>$a</code> could
be 3
-or 4, and both <code>$b</code> and <code>$c</code> could be 2 or 3.
+<p>Two threads both access <code>$x</code>. Each thread can potentially be
interrupted
+at any point, or be executed in any order. At the end, <code>$x</code> could
be 3
+or 4, and both <code>$y</code> and <code>$z</code> could be 2 or 3.
</p>
-<p>Even <code>$a += 5</code> or <code>$a++</code> are not guaranteed to be
atomic.
+<p>Even <code>$x += 5</code> or <code>$x++</code> are not guaranteed to be
atomic.
</p>
<p>Whenever your program accesses data or resources that can be accessed
by other threads, you must take steps to coordinate access or risk
@@ -97122,17 +97264,17 @@
</p>
<pre class="verbatim"> use threads;
- my $a :shared = 4;
- my $b :shared = 'foo';
+ my $x :shared = 4;
+ my $y :shared = 'foo';
my $thr1 = threads->create(sub {
- lock($a);
+ lock($x);
sleep(20);
- lock($b);
+ lock($y);
});
my $thr2 = threads->create(sub {
- lock($b);
+ lock($y);
sleep(20);
- lock($a);
+ lock($x);
});
</pre>
<p>This program will probably hang until you kill it. The only way it
@@ -97140,10 +97282,10 @@
first. A guaranteed-to-hang version is more complicated, but the
principle is the same.
</p>
-<p>The first thread will grab a lock on <code>$a</code>, then, after a pause
during which
+<p>The first thread will grab a lock on <code>$x</code>, then, after a pause
during which
the second thread has probably had time to do some work, try to grab a
-lock on <code>$b</code>. Meanwhile, the second thread grabs a lock on
<code>$b</code>, then later
-tries to grab a lock on <code>$a</code>. The second lock attempt for both
threads will
+lock on <code>$y</code>. Meanwhile, the second thread grabs a lock on
<code>$y</code>, then later
+tries to grab a lock on <code>$x</code>. The second lock attempt for both
threads will
block, each waiting for the other to release its lock.
</p>
<p>This condition is called a deadlock, and it occurs whenever two or
@@ -97154,8 +97296,8 @@
</p>
<p>There are a number of ways to handle this sort of problem. The best
way is to always have all threads acquire locks in the exact same
-order. If, for example, you lock variables <code>$a</code>, <code>$b</code>,
and <code>$c</code>, always lock
-<code>$a</code> before <code>$b</code>, and <code>$b</code> before
<code>$c</code>. It’s also best to hold on to locks for
+order. If, for example, you lock variables <code>$x</code>, <code>$y</code>,
and <code>$z</code>, always lock
+<code>$x</code> before <code>$y</code>, and <code>$y</code> before
<code>$z</code>. It’s also best to hold on to locks for
as short a period of time to minimize the risks of deadlock.
</p>
<p>The other synchronization primitives described below can suffer from
@@ -97613,9 +97755,9 @@
</p>
<p>Since kernel threading can interrupt a thread at any time, they will
uncover some of the implicit locking assumptions you may make in your
-program. For example, something as simple as <code>$a = $a + 2</code> can
behave
-unpredictably with kernel threads if <code>$a</code> is visible to other
-threads, as another thread may have changed <code>$a</code> between the time it
+program. For example, something as simple as <code>$x = $x + 2</code> can
behave
+unpredictably with kernel threads if <code>$x</code> is visible to other
+threads, as another thread may have changed <code>$x</code> between the time it
was fetched on the right hand side and the time the new value is
stored.
</p>
@@ -103204,11 +103346,11 @@
</p>
<pre class="verbatim"> sub nice_string {
join("",
- map { $_ > 255 ? # if wide character...
- sprintf("\\x{%04X}", $_) : # \x{...}
- chr($_) =~ /[[:cntrl:]]/ ? # else if control character...
- sprintf("\\x%02X", $_) : # \x..
- quotemeta(chr($_)) # else quoted or as themselves
+ map { $_ > 255 # if wide character...
+ ? sprintf("\\x{%04X}", $_) # \x{...}
+ : chr($_) =~ /[[:cntrl:]]/ # else if control character...
+ ? sprintf("\\x%02X", $_) # \x..
+ : quotemeta(chr($_)) # else quoted or as themselves
} unpack("W*", $_[0])); # unpack Unicode
characters
}
</pre>
@@ -104563,7 +104705,8 @@
<code>'</code> is taken to be a <em>package qualifier</em>; see <a
href="#perlmod-NAME">perlmod NAME</a>.
</p>
<p>Perl variable names may also be a sequence of digits or a single
-punctuation or control character. These names are all reserved for
+punctuation or control character (with the literal control character
+form deprecated). These names are all reserved for
special uses by Perl; for example, the all-digits names are used
to hold data captured by backreferences after a regular expression
match. Perl has a special syntax for the single-control-character
@@ -104947,19 +105090,19 @@
<p>The subscript separator for multidimensional array emulation. If you
refer to a hash element as
</p>
-<pre class="verbatim"> $foo{$a,$b,$c}
+<pre class="verbatim"> $foo{$x,$y,$z}
</pre>
<p>it really means
</p>
-<pre class="verbatim"> $foo{join($;, $a, $b, $c)}
+<pre class="verbatim"> $foo{join($;, $x, $y, $z)}
</pre>
<p>But don’t put
</p>
-<pre class="verbatim"> @foo{$a,$b,$c} # a slice--note the @
+<pre class="verbatim"> @foo{$x,$y,$z} # a slice--note the @
</pre>
<p>which means
</p>
-<pre class="verbatim"> ($foo{$a},$foo{$b},$foo{$c})
+<pre class="verbatim"> ($foo{$x},$foo{$y},$foo{$z})
</pre>
<p>Default is "\034", the same as SUBSEP in <strong>awk</strong>.
If your keys contain
binary data there might not be any safe value for <code>$;</code>.
Index: perldoc-all.html.gz
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.html.gz,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
Binary files /tmp/cvse1df2R and /tmp/cvsRW4zVt differ
Index: perldoc-all.html_chapter.tar.gz
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.html_chapter.tar.gz,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
Binary files /tmp/cvsHyLAMV and /tmp/cvs16vtUx differ
Index: perldoc-all.info.tar.gz
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.info.tar.gz,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
Binary files /tmp/cvsIDhbL2 and /tmp/cvsuGEJ4E differ
Index: perldoc-all.pdf
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.pdf,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
Binary files /tmp/cvs8VzOL8 and /tmp/cvs6FkKJL differ
Index: perldoc-all.texi.tar.gz
===================================================================
RCS file: /web/www/www/software/perl/manual/perldoc-all.texi.tar.gz,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
Binary files /tmp/cvs6LXDmx and /tmp/cvs2Cwxza differ
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- www/software/perl/manual index.html perldoc-all...,
karl <=