Change 15021 by jhi@alpha on 2002/03/04 22:06:22
Subject: [PATCH] small doc update to promote '-no_match_vars' of 'use English'
From: Jeffrey Friedl <[EMAIL PROTECTED]>
Date: Mon, 4 Mar 2002 12:14:45 -0800 (PST)
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/pod/perlform.pod#10 edit
.... //depot/perl/pod/perlipc.pod#33 edit
.... //depot/perl/pod/perlsec.pod#22 edit
.... //depot/perl/pod/perlvar.pod#87 edit
Differences ...
==== //depot/perl/pod/perlform.pod#10 (text) ====
Index: perl/pod/perlform.pod
--- perl/pod/perlform.pod.~1~ Mon Mar 4 15:15:05 2002
+++ perl/pod/perlform.pod Mon Mar 4 15:15:05 2002
@@ -187,7 +187,7 @@
If you use the English module, you can even read the variable names:
- use English;
+ use English '-no_match_vars';
$ofh = select(OUTF);
$FORMAT_NAME = "My_Other_Format";
$FORMAT_TOP_NAME = "My_Top_Format";
==== //depot/perl/pod/perlipc.pod#33 (text) ====
Index: perl/pod/perlipc.pod
--- perl/pod/perlipc.pod.~1~ Mon Mar 4 15:15:05 2002
+++ perl/pod/perlipc.pod Mon Mar 4 15:15:05 2002
@@ -374,7 +374,7 @@
STDIN. If you open a pipe I<from> minus, you can read from the filehandle
you opened whatever your kid writes to his STDOUT.
- use English;
+ use English '-no_match_vars';
my $sleep_count = 0;
do {
==== //depot/perl/pod/perlsec.pod#22 (text) ====
Index: perl/pod/perlsec.pod
--- perl/pod/perlsec.pod.~1~ Mon Mar 4 15:15:05 2002
+++ perl/pod/perlsec.pod Mon Mar 4 15:15:05 2002
@@ -242,7 +242,7 @@
best way to call something that might be subjected to shell escapes: just
never call the shell at all.
- use English;
+ use English '-no_match_vars';
die "Can't fork: $!" unless defined($pid = open(KID, "-|"));
if ($pid) { # parent
while (<KID>) {
==== //depot/perl/pod/perlvar.pod#87 (text) ====
Index: perl/pod/perlvar.pod
--- perl/pod/perlvar.pod.~1~ Mon Mar 4 15:15:05 2002
+++ perl/pod/perlvar.pod Mon Mar 4 15:15:05 2002
@@ -13,14 +13,20 @@
use English;
-at the top of your program. This will alias all the short names to the
-long names in the current package. Some even have medium names,
-generally borrowed from B<awk>.
+at the top of your program. This aliases all the short names to the long
+names in the current package. Some even have medium names, generally
+borrowed from B<awk>. In general, it's best to use the
+
+ use English '-no_match_vars';
+
+invocation if you don't need $PREMATCH, $MATCH, or $POSTMATCH, as it avoids
+a certain performance hit with the use of regular expressions. See
+L<English>.
-If you don't mind the performance hit, variables that depend on the
-currently selected filehandle may instead be set by calling an
-appropriate object method on the IO::Handle object. (Summary lines
-below for this contain the word HANDLE.) First you must say
+Variables that depend on the currently selected filehandle may be set by
+calling an appropriate object method on the IO::Handle object, although
+this is less efficient than using the regular built-in variables. (Summary
+lines below for this contain the word HANDLE.) First you must say
use IO::Handle;
@@ -33,10 +39,11 @@
HANDLE->method(EXPR)
Each method returns the old value of the IO::Handle attribute.
-The methods each take an optional EXPR, which if supplied specifies the
+The methods each take an optional EXPR, which, if supplied, specifies the
new value for the IO::Handle attribute in question. If not supplied,
most methods do nothing to the current value--except for
autoflush(), which will assume a 1 for you, just to be different.
+
Because loading in the IO::Handle class is an expensive operation, you should
learn how to use the regular built-in variables.
End of Patch.