PerlFAQ sync.
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 23 Mar 2007 14:33:22 +0000 (14:33 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 23 Mar 2007 14:33:22 +0000 (14:33 +0000)
Also, use a svn checkout done under an English locale, to
avoid having French dates in the headers. Hateful.

p4raw-id: //depot/perl@30721

pod/perlfaq1.pod
pod/perlfaq2.pod
pod/perlfaq3.pod
pod/perlfaq4.pod
pod/perlfaq5.pod
pod/perlfaq6.pod
pod/perlfaq7.pod
pod/perlfaq8.pod
pod/perlfaq9.pod

index 4a10d6a0213eb1a0af49276ab6a4b65bbf2b8311..bb166eff94594c7347ef045a6e03de9941fbd29a 100644 (file)
@@ -392,7 +392,7 @@ You might find these links useful:
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index dd028cd1bfa44708fb5d3a6819e1f91f7a660c45..a276b83ce6f5f2c7795ec0a56ea933722a88b7b9 100644 (file)
@@ -522,7 +522,7 @@ the I<What is CPAN?> question earlier in this document.
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index 434bf3acd69ae2550690ef3438b1624654788e6c..bc2607a0eab339fd54679d252e3e2e083e184a45 100644 (file)
@@ -984,7 +984,7 @@ to process and install a Perl distribution.
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index 6fb4d37a8bf4de44f6ad5c45e3017f0bf25732f1..25418d02169493dbaa12de4df1c42738de023a78 100644 (file)
@@ -2262,7 +2262,7 @@ the C<PDL> module from CPAN instead--it makes number-crunching easy.
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index 0ed699219272b3a68ecaf3a4e9798629144df1ae..dd11f6633aaf564188fc1dd5db4313de07beecc5 100644 (file)
@@ -1282,7 +1282,7 @@ If your array contains lines, just print them:
 
 Revision: $Revision: 8579 $
 
-Date: $Date: 2007-01-14 19:28:09 +0100 (dim, 14 jan 2007) $
+Date: $Date: 2007-01-14 19:28:09 +0100 (Sun, 14 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index c872f9bd68296f11dbea8fd765d70576df692816..90edc7b5eac3e1e39a6d4cce7a1d92d0f8875565 100644 (file)
@@ -986,7 +986,7 @@ Or...
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index 503f69d2c91a5a49242d9e3dec5a5fc07edbf603..9889104dfb95545ca450d9b53d3cb2d58b839d0c 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq7 - General Perl Language Issues ($Revision: 8539 $)
+perlfaq7 - General Perl Language Issues ($Revision: 9309 $)
 
 =head1 DESCRIPTION
 
@@ -647,24 +647,8 @@ where they don't belong.
 
 =head2 How do I create a switch or case statement?
 
-This is explained in more depth in the L<perlsyn>.  Briefly, there's
-no official case statement, because of the variety of tests possible
-in Perl (numeric comparison, string comparison, glob comparison,
-regex matching, overloaded comparisons, ...).  Larry couldn't decide
-how best to do this, so he left it out, even though it's been on the
-wish list since perl1.
-
-Starting from Perl 5.8 to get switch and case one can use the
-Switch extension and say:
-
-       use Switch;
-
-after which one has switch and case.  It is not as fast as it could be
-because it's not really part of the language (it's done using source
-filters) but it is available, and it's very flexible.
-
-But if one wants to use pure Perl, the general answer is to write a
-construct like this:
+If one wants to use pure Perl and to be compatible with Perl versions
+prior to 5.10, the general answer is to write a construct like this:
 
     for ($variable_to_test) {
        if    (/pat1/)  { }     # do something
@@ -673,8 +657,8 @@ construct like this:
        else            { }     # default
     }
 
-Here's a simple example of a switch based on pattern matching, this
-time lined up in a way to make it look more like a switch statement.
+Here's a simple example of a switch based on pattern matching,
+lined up in a way to make it look more like a switch statement.
 We'll do a multiway conditional based on the type of reference stored
 in $whatchamacallit:
 
@@ -708,8 +692,7 @@ in $whatchamacallit:
 
     }
 
-See C<perlsyn/"Basic BLOCKs and Switch Statements"> for many other
-examples in this style.
+See L<perlsyn> for other examples in this style.
 
 Sometimes you should change the positions of the constant and the variable.
 For example, let's say you wanted to test which of many answers you were
@@ -743,6 +726,15 @@ A totally different approach is to create a hash of function references.
         print "No such command: $string\n";
     }
 
+Note that starting from version 5.10, Perl has now a native switch
+statement. See L<perlsyn>.
+
+Starting from Perl 5.8, a source filter module, C<Switch>, can also be
+used to get switch and case. Its use is now discouraged, because it's
+not fully compatible with the native switch of Perl 5.10, and because,
+as it's implemented as a source filter, it doesn't always work as intended
+when complex syntax is involved.
+
 =head2 How can I catch accesses to undefined variables, functions, or methods?
 
 The AUTOLOAD method, discussed in L<perlsub/"Autoloading"> and
@@ -978,9 +970,9 @@ where you expect it so you need to adjust your shebang line.
 
 =head1 REVISION
 
-Revision: $Revision: 8539 $
+Revision: $Revision: 9309 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-03-23 15:28:16 +0100 (Fri, 23 Mar 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index 92e0694f0897fdc93d1247eb61c8492a90ede2b2..628e02216c585da8f1c2d0acc21064aec67b9d14 100644 (file)
@@ -1260,7 +1260,7 @@ but other times it is not.  Modern programs C<use Socket;> instead.
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.
 
index 2bed9d9d4e13daa4e15723dc1e9c34be686abc3a..609f8984851bdb5c16f88091d9687ce846b83593 100644 (file)
@@ -667,7 +667,7 @@ http://search.cpan.org/search?query=RPC&mode=all ).
 
 Revision: $Revision: 8539 $
 
-Date: $Date: 2007-01-11 00:07:14 +0100 (jeu, 11 jan 2007) $
+Date: $Date: 2007-01-11 00:07:14 +0100 (Thu, 11 Jan 2007) $
 
 See L<perlfaq> for source control details and availability.