[Israel.pm] package/sub ambiguity
semuelf at 012.net.il
Sun Jun 1 13:53:52 PDT 2008
Yitzchak Scott-Thoennes wrote:
> On Sun, June 1, 2008 12:25 pm, Shmuel Fomberg wrote:
>> I did: $r = Repeater->create(...);
>> I actually got: $r = (&Repeater())->create(...);
> Yes, if there's a sub Repeater declared at the time the method call is
> compiled, it will get called; if there's not, it's autoquoted for you.
>> A way to resolve that was to write:
>> $r = "Repeater"->create(...);
>> Any advice from the community? I actually liked the sub-package name
> I like $r = Repeater::->create(...);
Cute. And that will only work if the package was already declared.
Good to know, anyway.
More information about the Perl