summaryrefslogtreecommitdiff
path: root/pod/perlobj.pod
diff options
context:
space:
mode:
authorian.goodacre@xtra.co.nz (via RT) <perlbug-followup@perl.org>2009-01-02 14:36:54 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-01-02 14:36:54 +0100
commite947c198f4d08c5b6342363b752901f195bc5cb5 (patch)
treed95c2a2f881b21ddbf495070a996315cf1c2cb15 /pod/perlobj.pod
parent1cfb70492a75e71d0d138b31ac879fa68a42e0f3 (diff)
downloadperl-e947c198f4d08c5b6342363b752901f195bc5cb5.tar.gz
[perl #61392] Method call documentation in perlobj.pod
Diffstat (limited to 'pod/perlobj.pod')
-rw-r--r--pod/perlobj.pod13
1 files changed, 13 insertions, 0 deletions
diff --git a/pod/perlobj.pod b/pod/perlobj.pod
index b0592ffc6d..5b6adbabd4 100644
--- a/pod/perlobj.pod
+++ b/pod/perlobj.pod
@@ -313,6 +313,19 @@ The right side of the arrow typically is the method name, but a simple
scalar variable containing either the method name or a subroutine
reference can also be used.
+If the right side of the arrow is a scalar containing a reference
+to a subroutine, then this is equivalent to calling the referenced
+subroutine directly with the class name or object on the left side
+of the arrow as its first argument. No lookup is done and there is
+no requirement that the subroutine be defined in any package related
+to the class name or object on the left side of the arrow.
+
+For example, the following calls to $display are equivalent:
+
+ my $display = sub { my $self = shift; ... };
+ $fred->$display("Height", "Weight");
+ $display->($fred, "Height", "Weight");
+
=head2 Indirect Object Syntax
X<indirect object syntax> X<invocation, indirect> X<indirect>