I am writing a WxPerl program and instead
$panel->SetDropTarget( MyTextDropTarget->new($panel) );
I wrote
$panel->SetDropTarget->( MyTextDropTarget->new($panel) );
and Perl did not complain. (Perl called some function with some arguments, and the script made an error with an error message:
Usage: Wx :: Window :: SetDropTarget (IT, target) in a string. /x.pl 230.
I'm curious how Perl parsed the โwrongโ version.
Editing added:
Ok, so if $ x = \ & some_function, then I understand why
$x->($arg1, $arg2, ...)
calls some_function ($ arg1, $ arg2, .....).
The runrig example is one of the possibilities, but I am sure that: 1) $ panel contains a link to a blissful object, not a string. 2) SetDropTarget is a method (in the base class) of $ panel.
From the error message, it can be assumed that SetDropTarget () is being called. If the Runrig example is used here (and I would suggest that it is), then even if SetDropTarget does not follow the brackets, that is, I have
$panel->SetDropTarget->
instead
$panel->SetDropTarget()->
Does Perl still call SetDropTarget? (which checks the number and type of its arguments, and then mortally complains at run time). Is that what is happening?
Jonathan
source share