In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/459fc3ca45067f8a2b7f262f7aac0a99372c2a88?hp=0e44158ce94d11dde580b3793579946c7d918b97>

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

    mention perlivp in release_managers_guide

M       Porting/release_managers_guide.pod

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

    better document smart match overloading

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 7790832..d5ac5ad 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -455,6 +455,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 c7db812..59f268e 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -735,13 +735,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