cvs commit: perlfaq perlfaq.pod perlfaq3.pod perlfaq4.pod perlfaq6.pod perlfaq7.pod perlfaq8.pod perlfaq9.pod
[email protected] (Robert Spier) 4 Jun 2005 04:12:41 -0000
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/06/03 21:12:41
Modified: . perlfaq.pod perlfaq3.pod perlfaq4.pod perlfaq6.pod
perlfaq7.pod perlfaq8.pod perlfaq9.pod
Log:
syncs from p5p
06/03(Fri)01:28 [ Rafael Garcia-Su ] Change 24685: Indent fix
06/03(Fri)01:43 [ Rafael Garcia-Su ] Change 24686: [PATCH] Quotes in pod/*.pod
Revision Changes Path
1.23 +37 -29 perlfaq/perlfaq.pod
Index: perlfaq.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq.pod,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- perlfaq.pod 27 Mar 2005 07:21:21 -0000 1.22
+++ perlfaq.pod 4 Jun 2005 04:12:40 -0000 1.23
@@ -45,7 +45,7 @@
=head1 Author and Copyright Information
-Copyright (c) 1997-2003 Tom Christiansen, Nathan Torkington, and
+Copyright (c) 1997-2005 Tom Christiansen, Nathan Torkington, and
other contributors noted in the answers.
All rights reserved.
@@ -398,7 +398,7 @@
=item *
-Why is int() broken?
+Why is C<int()> broken?
=item *
@@ -406,7 +406,7 @@
=item *
-Does Perl have a round() function? What about ceil() and floor()? Trig functions?
+Does Perl have a C<round()> function? What about C<ceil()> and C<floor()>? Trig functions?
=item *
@@ -550,7 +550,7 @@
=item *
-What is the difference between $array[1] and @array[1]?
+What is the difference between C<$array[1]> and C<@array[1]>?
=item *
@@ -606,7 +606,7 @@
=item *
-Why does defined() return true on empty arrays and hashes?
+Why does C<defined()> return true on empty arrays and hashes?
=item *
@@ -642,7 +642,7 @@
=item *
-How do I reset an each() operation part-way through?
+How do I reset an C<each()> operation part-way through?
=item *
@@ -743,11 +743,11 @@
=item *
-How can I set up a footer format to be used with write()?
+How can I set up a footer format to be used with C<write()>?
=item *
-How can I write() into a string?
+How can I C<write()> into a string?
=item *
@@ -767,7 +767,7 @@
=item *
-Is there a leak/bug in glob()?
+Is there a leak/bug in C<glob()>?
=item *
@@ -783,7 +783,7 @@
=item *
-Why can't I just open(FH, "E<gt>file.lock")?
+Why can't I just C<< open(FH, ">file.lock") >>?
=item *
@@ -831,7 +831,7 @@
=item *
-How do I dup() a filehandle in Perl?
+How do I C<dup()> a filehandle in Perl?
=item *
@@ -843,7 +843,7 @@
=item *
-Why doesn't glob("*.*") get all the files?
+Why doesn't C<glob("*.*")> get all the files?
=item *
@@ -862,7 +862,13 @@
=head2 L<perlfaq6>: Regular Expressions
-This section is surprisingly small because the rest of the FAQ is littered with answers involving regular expressions. For example, decoding a URL and checking whether something is a number are handled with regular expressions, but those answers are found elsewhere in this document (in L<perlfaq9>: ``How do I decode or create those %-encodings on the web'' and L<perlfaq4>: ``How do I determine whether a scalar is a number/whole/integer/float'', to be precise).
+This section is surprisingly small because the rest of the FAQ is
+littered with answers involving regular expressions. For example,
+decoding a URL and checking whether something is a number are handled
+with regular expressions, but those answers are found elsewhere in this
+document (in L<perlfaq9>: "How do I decode or create those %-encodings
+on the web" and L<perlfaq4>: "How do I determine whether a scalar is
+a number/whole/integer/float", to be precise).
=over 4
@@ -880,7 +886,7 @@
=item *
-I put a regular expression into $/ but it didn't work. What's wrong?
+I put a regular expression into C<$/> but it didn't work. What's wrong?
=item *
@@ -936,7 +942,7 @@
=item *
-Why does using $&, $`, or $' slow my program down?
+Why does using C<$&>, C<$`>, or C<$'> slow my program down?
=item *
@@ -1041,7 +1047,7 @@
=item *
-Why doesn't "my($foo) = E<lt>FILEE<gt>;" work right?
+Why doesn't C<< my($foo) = <FILE>; >> work right?
=item *
@@ -1049,7 +1055,7 @@
=item *
-What's the difference between calling a function as &foo and foo()?
+What's the difference between calling a function as C<&foo> and C<foo()>?
=item *
@@ -1098,7 +1104,7 @@
=item *
-How come exec() doesn't return?
+How come C<exec()> doesn't return?
=item *
@@ -1154,7 +1160,7 @@
=item *
-How can I sleep() or alarm() for under a second?
+How can I C<sleep()> or C<alarm()> for under a second?
=item *
@@ -1162,7 +1168,7 @@
=item *
-How can I do an atexit() or setjmp()/longjmp()? (Exception handling)
+How can I do an C<atexit()> or C<setjmp()>/C<longjmp()>? (Exception handling)
=item *
@@ -1174,7 +1180,7 @@
=item *
-Where do I get the include files to do ioctl() or syscall()?
+Where do I get the include files to do C<ioctl()> or C<syscall()>?
=item *
@@ -1186,7 +1192,7 @@
=item *
-Why can't I get the output of a command with system()?
+Why can't I get the output of a command with C<system()>?
=item *
@@ -1194,7 +1200,7 @@
=item *
-Why doesn't open() return an error when a pipe open fails?
+Why doesn't C<open()> return an error when a pipe open fails?
=item *
@@ -1226,7 +1232,9 @@
=item *
-I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible?
+I {changed directory, modified my environment} in a perl script. How come
+the change disappeared when I exited the script? How do I get my changes
+to be visible?
=item *
@@ -1258,7 +1266,7 @@
=item *
-How do I make a system() exit on control-C?
+How do I make a C<system()> exit on control-C?
=item *
@@ -1286,11 +1294,11 @@
=item *
-How do I add a directory to my include path (@INC) at runtime?
+How do I add a directory to my include path (C<@INC>) at runtime?
=item *
-What is socket.ph and where do I get it?
+What is F<socket.ph> and where do I get it?
=back
@@ -1351,7 +1359,7 @@
=item *
-How do I edit my .htpasswd and .htgroup files with Perl?
+How do I edit my F<.htpasswd> and F<.htgroup> files with Perl?
=item *
1.49 +11 -20 perlfaq/perlfaq3.pod
Index: perlfaq3.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq3.pod,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- perlfaq3.pod 22 Apr 2005 19:04:48 -0000 1.48
+++ perlfaq3.pod 4 Jun 2005 04:12:40 -0000 1.49
@@ -31,7 +31,7 @@
=head2 How can I use Perl interactively?
The typical approach uses the Perl debugger, described in the
-perldebug(1) manpage, on an ``empty'' program, like this:
+perldebug(1) manpage, on an "empty" program, like this:
perl -de 42
@@ -481,8 +481,8 @@
and profile to make sure you're optimizing the right part, look for
better algorithms instead of microtuning your code, and when all else
fails consider just buying faster hardware. You will probably want to
-read the answer to the earlier question ``How do I profile my Perl
-programs?'' if you haven't done so already.
+read the answer to the earlier question "How do I profile my Perl
+programs?" if you haven't done so already.
A different approach is to autoload seldom-used Perl code. See the
AutoSplit and AutoLoader modules in the standard distribution for
@@ -696,19 +696,10 @@
See http://www.cpan.org/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/ .
-A non-free, commercial product, ``The Velocity Engine for Perl'',
-(http://www.binevolve.com/ or http://www.binevolve.com/velocigen/ )
-might also be worth looking at. It will allow you to increase the
-performance of your Perl programs, running programs up to 25 times
-faster than normal CGI Perl when running in persistent Perl mode or 4
-to 5 times faster without any modification to your existing CGI
-programs. Fully functional evaluation copies are available from the
-web site.
-
=head2 How can I hide the source for my Perl program?
Delete it. :-) Seriously, there are a number of (mostly
-unsatisfactory) solutions with varying levels of ``security''.
+unsatisfactory) solutions with varying levels of "security".
First of all, however, you I<can't> take away read permission, because
the source code has to be readable in order to be compiled and
@@ -743,9 +734,9 @@
If you're concerned about people profiting from your code, then the
bottom line is that nothing but a restrictive license will give you
legal security. License your software and pepper it with threatening
-statements like ``This is unpublished proprietary software of XYZ Corp.
+statements like "This is unpublished proprietary software of XYZ Corp.
Your access to it does not give you permission to use it blah blah
-blah.'' We are not lawyers, of course, so you should see a lawyer if
+blah." We are not lawyers, of course, so you should see a lawyer if
you want to be sure your license's wording will stand up in court.
=head2 How can I compile my Perl program into byte code or C?
@@ -802,7 +793,7 @@
extproc perl -S -your_switches
as the first line in C<*.cmd> file (C<-S> due to a bug in cmd.exe's
-`extproc' handling). For DOS one should first invent a corresponding
+"extproc" handling). For DOS one should first invent a corresponding
batch file and codify it in C<ALTERNATE_SHEBANG> (see the
F<dosish.h> file in the source distribution for more information).
@@ -900,9 +891,9 @@
For modules, get the CGI or LWP modules from CPAN. For textbooks,
see the two especially dedicated to web stuff in the question on
-books. For problems and questions related to the web, like ``Why
-do I get 500 Errors'' or ``Why doesn't it run from the browser right
-when it runs fine on the command line'', see the troubleshooting
+books. For problems and questions related to the web, like "Why
+do I get 500 Errors" or "Why doesn't it run from the browser right
+when it runs fine on the command line", see the troubleshooting
guides and references in L<perlfaq9> or in the CGI MetaFAQ:
http://www.perl.org/CGI_MetaFAQ.html
1.65 +8 -8 perlfaq/perlfaq4.pod
Index: perlfaq4.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- perlfaq4.pod 27 Apr 2005 00:18:04 -0000 1.64
+++ perlfaq4.pod 4 Jun 2005 04:12:40 -0000 1.65
@@ -349,16 +349,16 @@
(despite appearances caused by bugs in your programs :-). see the
F<random> article in the "Far More Than You Ever Wanted To Know"
collection in http://www.cpan.org/misc/olddoc/FMTEYEWTK.tgz , courtesy of
-Tom Phoenix, talks more about this. John von Neumann said, ``Anyone
+Tom Phoenix, talks more about this. John von Neumann said, "Anyone
who attempts to generate random numbers by deterministic means is, of
-course, living in a state of sin.''
+course, living in a state of sin."
If you want numbers that are more random than C<rand> with C<srand>
provides, you should also check out the Math::TrulyRandom module from
CPAN. It uses the imperfections in your system's timer to generate
random numbers, but this takes quite a while. If you want a better
pseudorandom generator than comes with your operating system, look at
-``Numerical Recipes in C'' at http://www.nr.com/ .
+"Numerical Recipes in C" at http://www.nr.com/ .
=head2 How do I get a random number between X and Y?
@@ -532,8 +532,8 @@
That doesn't mean that Perl can't be used to create non-Y2K compliant
programs. It can. But so can your pencil. It's the fault of the user,
-not the language. At the risk of inflaming the NRA: ``Perl doesn't
-break Y2K, people do.'' See http://www.perl.org/about/y2k.html for
+not the language. At the risk of inflaming the NRA: "Perl doesn't
+break Y2K, people do." See http://www.perl.org/about/y2k.html for
a longer exposition.
=head1 Data: Strings
@@ -553,7 +553,7 @@
=head2 How do I unescape a string?
-It depends just what you mean by ``escape''. URL escapes are dealt
+It depends just what you mean by "escape". URL escapes are dealt
with in L<perlfaq9>. Shell escapes with the backslash (C<\>)
character are removed with
@@ -2037,7 +2037,7 @@
wrapper function for more convenient access. This function takes
a string and returns the number it found, or C<undef> for input that
isn't a C float. The C<is_numeric> function is a front end to C<getnum>
-if you just want to say, ``Is this a float?''
+if you just want to say, "Is this a float?"
sub getnum {
use POSIX qw(strtod);
1.33 +7 -7 perlfaq/perlfaq6.pod
Index: perlfaq6.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq6.pod,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- perlfaq6.pod 22 Apr 2005 19:04:48 -0000 1.32
+++ perlfaq6.pod 4 Jun 2005 04:12:40 -0000 1.33
@@ -8,9 +8,9 @@
littered with answers involving regular expressions. For example,
decoding a URL and checking whether something is a number are handled
with regular expressions, but those answers are found elsewhere in
-this document (in L<perlfaq9>: ``How do I decode or create those %-encodings
-on the web'' and L<perlfaq4>: ``How do I determine whether a scalar is
-a number/whole/integer/float'', to be precise).
+this document (in L<perlfaq9>: "How do I decode or create those %-encodings
+on the web" and L<perlfaq4>: "How do I determine whether a scalar is
+a number/whole/integer/float", to be precise).
=head2 How can I hope to use regular expressions without creating illegible and unmaintainable code?
@@ -509,8 +509,8 @@
print "$count $line";
}
-If you want these output in a sorted order, see L<perlfaq4>: ``How do I
-sort a hash (optionally by value instead of key)?''.
+If you want these output in a sorted order, see L<perlfaq4>: "How do I
+sort a hash (optionally by value instead of key)?".
=head2 How can I do approximate matching?
@@ -794,7 +794,7 @@
Here are a few ways, all painful, to deal with it:
- $martian =~ s/([A-Z][A-Z])/ $1 /g; # Make sure adjacent ``martian''
+ $martian =~ s/([A-Z][A-Z])/ $1 /g; # Make sure adjacent "martian"
# bytes are no longer adjacent.
print "found GX!\n" if $martian =~ /GX/;
1.24 +10 -10 perlfaq/perlfaq7.pod
Index: perlfaq7.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq7.pod,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- perlfaq7.pod 7 Apr 2005 21:39:34 -0000 1.23
+++ perlfaq7.pod 4 Jun 2005 04:12:40 -0000 1.24
@@ -296,7 +296,7 @@
objects. See L<perlsub/"Pass by Reference"> for this particular
question, and L<perlref> for information on references.
-See ``Passing Regexes'', below, for information on passing regular
+See "Passing Regexes", below, for information on passing regular
expressions.
=over 4
@@ -431,16 +431,16 @@
The data in chunk of memory defined by C<$count> is private to
C<counter>.
- BEGIN {
- my $count = 1;
- sub counter { $count++ }
- }
+ BEGIN {
+ my $count = 1;
+ sub counter { $count++ }
+ }
- my $start = count();
+ my $start = count();
- .... # code that calls count();
+ .... # code that calls count();
- my $end = count();
+ my $end = count();
In the previous example, you created a function-private variable
because only one function remembered its reference. You could define
@@ -457,7 +457,7 @@
my $count = 1;
sub increment_count { $count++ }
sub return_count { $count }
- }
+ }
To declare a file-private variable, you still use a lexical variable.
A file is also a scope, so a lexical variable defined in the file
1.25 +8 -8 perlfaq/perlfaq8.pod
Index: perlfaq8.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq8.pod,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- perlfaq8.pod 22 Apr 2005 19:04:48 -0000 1.24
+++ perlfaq8.pod 4 Jun 2005 04:12:40 -0000 1.25
@@ -276,8 +276,8 @@
If you expect characters to get to your device when you print() them,
you'll want to autoflush that filehandle. You can use select()
and the C<$|> variable to control autoflushing (see L<perlvar/$E<verbar>>
-and L<perlfunc/select>, or L<perlfaq5>, ``How do I flush/unbuffer an
-output filehandle? Why must I do this?''):
+and L<perlfunc/select>, or L<perlfaq5>, "How do I flush/unbuffer an
+output filehandle? Why must I do this?"):
$oldh = select(DEV);
$| = 1;
@@ -411,7 +411,7 @@
generates a signal which is sent to your terminal's currently
foregrounded process group, which you then trap in your process.
Signals are documented in L<perlipc/"Signals"> and the
-section on ``Signals'' in the Camel.
+section on "Signals" in the Camel.
You can set the values of the %SIG hash to be the functions you want
to handle the signal. After perl catches the signal, it looks in %SIG
@@ -527,7 +527,7 @@
Perl's exception-handling mechanism is its eval() operator. You can
use eval() as setjmp and die() as longjmp. For details of this, see
the section on signals, especially the time-out handler for a blocking
-flock() in L<perlipc/"Signals"> or the section on ``Signals'' in
+flock() in L<perlipc/"Signals"> or the section on "Signals" in
the Camel Book.
If exception handling is all you're interested in, try the
@@ -1017,7 +1017,7 @@
Use the alarm() function, probably in conjunction with a signal
handler, as documented in L<perlipc/"Signals"> and the section on
-``Signals'' in the Camel. You may instead use the more flexible
+"Signals" in the Camel. You may instead use the more flexible
Sys::AlarmCall module available from CPAN.
The alarm() function is not implemented on all versions of Windows.
@@ -1177,8 +1177,8 @@
get a new F<perl> binary with your extension linked in.
See L<ExtUtils::MakeMaker> for more details on building extensions.
-See also the next question, ``What's the difference between require
-and use?''.
+See also the next question, "What's the difference between require
+and use?".
=head2 What's the difference between require and use?
1.22 +3 -3 perlfaq/perlfaq9.pod
Index: perlfaq9.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq9.pod,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- perlfaq9.pod 22 Apr 2005 19:04:48 -0000 1.21
+++ perlfaq9.pod 4 Jun 2005 04:12:40 -0000 1.22
@@ -322,7 +322,7 @@
consistent OO interface to these files, regardless of how they're
stored. Databases may be text, dbm, Berkeley DB or any database with
a DBI compatible driver. HTTPD::UserAdmin supports files used by the
-`Basic' and `Digest' authentication schemes. Here's an example:
+"Basic" and "Digest" authentication schemes. Here's an example:
use HTTPD::UserAdmin ();
HTTPD::UserAdmin
@@ -439,7 +439,7 @@
(personal ID number). Record the address and PIN (best that it be a
random one) for later processing. In the mail you send, ask them to
include the PIN in their reply. But if it bounces, or the message is
-included via a ``vacation'' script, it'll be there anyway. So it's
+included via a "vacation" script, it'll be there anyway. So it's
best to ask them to mail back a slight alteration of the PIN, such as
with the characters reversed, one added or subtracted to each digit, etc.