Yes THIS could be better.
it says:
How does Perl know which package the subroutine is in? By
looking at the left side of the arrow, which must be either
a package name or a reference to an object, i.e. something
that has been blessed to a package. Either way, that's the
package where Perl starts looking. If that package has no
subroutine with that name, Perl starts looking for it in
any base classes of that package, and so on.
...
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 there was any paragraph saying something like
$obj->$coderef(@paras) is equivalent to $coderef->($obj,@paras) "no matter if the RHS and the LHS have any package relation"!
would be a much clearer definiton and avoiding the need to experiment. (well I'm not sure how to express the "no matter" part in clear English, but I hope the point is clear)
UPDATED: Typo in code. | [reply] [d/l] [select] |
| [reply] |
| [reply] |
That doesn't describe the RHS of -> at all?
Nevermind, I see what you're saying.
| [reply] [d/l] |