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

<http://perl5.git.perl.org/perl.git/commitdiff/2093ad8b023433f6b00c09d3737eb378cd540501?hp=84878b9b68e0b2febdcbd6c45be9a0b04e47fbd6>

- Log -----------------------------------------------------------------
commit 2093ad8b023433f6b00c09d3737eb378cd540501
Author: David Mitchell <[email protected]>
Date:   Sat Aug 22 20:45:09 2009 +0100

    mention perlivp in release_managers_guide
    
    (cherry picked from commit 459fc3ca45067f8a2b7f262f7aac0a99372c2a88)

M       Porting/release_managers_guide.pod

commit d3ef07439595fe57fc685df80d71f5df4f4510d7
Author: David Mitchell <[email protected]>
Date:   Sat Aug 22 20:43:00 2009 +0100

    better document smart match overloading
    
    (cherry picked from commit 0de1c906c34397b53c088e443cd0325d9c209649)

M       lib/overload.pm
M       pod/perlsyn.pod
-----------------------------------------------------------------------

Summary of changes:
 Porting/release_managers_guide.pod |    9 +++++++++
 lib/overload.pm                    |   25 +++++++++++++++++++++++++
 pod/perlsyn.pod                    |   14 ++++++++++++--
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/Porting/release_managers_guide.pod 
b/Porting/release_managers_guide.pod
index 2f1fb27..1855d1a 100644
--- a/Porting/release_managers_guide.pod
+++ b/Porting/release_managers_guide.pod
@@ -629,6 +629,15 @@ which is why you should test from the tarball.
 
 =item *
 
+Run the Installation Verification Procedure utility:
+
+    $ bin/perlivp
+    ...
+    All tests successful.
+    $
+
+=item *
+
 Compare the pathnames of all installed files with those of the previous
 release (i.e. against the last installed tarball on this branch which you
 have previously verified using this same procedure). In particular, look
diff --git a/lib/overload.pm b/lib/overload.pm
index 0cb4771..f83191b 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -427,6 +427,31 @@ 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>.
 
+Unusually, overloading of the smart match operator does not automatically
+take precedence over normal smart match behaviour. In particular, in the
+following code:
+
+    package Foo;
+    use overload '~~' => 'match';
+
+    my $obj =  Foo->new();
+    $obj ~~ [ 1,2,3 ];
+
+the smart match does I<not> invoke the method call like this:
+
+    $obj->match([1,2,3],0);
+
+rather, the smart match distributive rule takes precedence, so $obj is
+smart matched against each array element in turn until a match is found,
+so you may see between one and three of these calls instead:
+
+    $obj->match(1,0);
+    $obj->match(2,0);
+    $obj->match(3,0);
+
+Consult the match table in  L<perlsyn/"Smart matching in detail"> for
+details of when overloading is invoked.
+
 =item * I<Dereferencing>
 
     '${}', '@{}', '%{}', '&{}', '*{}'.
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index 2a83a1c..cd95012 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -717,13 +717,23 @@ C<grep> does not.
 =head3 Custom matching via overloading
 
 You can change the way that an object is matched by overloading
-the C<~~> operator. This trumps the usual smart match semantics.
-See L<overload>.
+the C<~~> operator. This may alter the usual smart match semantics.
 
 It should be noted that C<~~> will refuse to work on objects that
 don't overload it (in order to avoid relying on the object's
 underlying structure).
 
+Note also that smart match's matching rules take precedence over
+overloading, so if C<$obj> has smart match overloading, then
+
+    $obj ~~ X
+
+will not automatically invoke the overload method with X as an argument;
+instead the table above is consulted as normal, and based in the type of X,
+overloading may or may not be invoked.
+
+See L<overload>.
+
 =head3 Differences from Perl 6
 
 The Perl 5 smart match and C<given>/C<when> constructs are not

--
Perl5 Master Repository

Reply via email to