In perl.git, the branch maint-5.10 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/b7b3ac231a23ed1cc1b90a1ade1bad9fe28d847e?hp=258cccad0bdc457934bddf4949238caef4203e8e>

- Log -----------------------------------------------------------------
commit b7b3ac231a23ed1cc1b90a1ade1bad9fe28d847e
Author: Chip Salzenberg <[email protected]>
Date:   Thu Aug 20 11:48:25 2009 -0700

    improve smart match documentation, per DM
-----------------------------------------------------------------------

Summary of changes:
 lib/overload.pm |    5 +++--
 pod/perlsyn.pod |   17 ++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/overload.pm b/lib/overload.pm
index b48cae2..0cb4771 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -423,8 +423,9 @@ once and with scalar context.
 
 =item * I<Matching>
 
-The key C<"~~"> allows you to override the smart matching used by
-the switch construct. See L<feature>.
+The key C<"~~"> allows you to override the smart matching logic used by
+the C<~~> operator and the switch construct (C<given>/C<when>).  See
+L<perlsyn/switch> and L<feature>.
 
 =item * I<Dereferencing>
 
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index 147844a..2a83a1c 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -550,8 +550,10 @@ is exactly equivalent to
 
        when($_ ~~ $foo)
 
-In fact C<when(EXPR)> is treated as an implicit smart match most of the
-time. The exceptions are that when EXPR is:
+Most of the time, C<when(EXPR)> is treated as an implicit smart match of
+C<$_>, i.e. C<$_ ~~ EXPR>. (See L</"Smart matching in detail"> for more
+information on smart matching.) But when EXPR is one of the below
+exceptional cases, it is used directly as a boolean:
 
 =over 4
 
@@ -622,9 +624,6 @@ for example.
 C<default> behaves exactly like C<when(1 == 1)>, which is
 to say that it always matches.
 
-See L</"Smart matching in detail"> for more information
-on smart matching.
-
 =head3 Breaking out
 
 You can use the C<break> keyword to break out of the enclosing
@@ -672,6 +671,10 @@ implicitly dereferences any non-blessed hash or array ref, 
so the "Hash"
 and "Array" entries apply in those cases. (For blessed references, the
 "Object" entries apply.)
 
+Note that the "Matching Code" column is not always an exact rendition.  For
+example, the smart match operator short-circuits whenever possible, but
+C<grep> does not.
+
     $a      $b        Type of Match Implied    Matching Code
     ======  =====     =====================    =============
     Any     undef     undefined                !defined $a
@@ -711,10 +714,6 @@ and "Array" entries apply in those cases. (For blessed 
references, the
  3 - If a circular reference is found, we fall back to referential equality.
  4 - either a real number, or a string that looks like a number
 
-The "matching code" doesn't represent the I<real> matching code,
-of course: it's just there to explain the intended meaning. Unlike
-C<grep>, the smart match operator will short-circuit whenever it can.
-
 =head3 Custom matching via overloading
 
 You can change the way that an object is matched by overloading

--
Perl5 Master Repository

Reply via email to