in reply to Re: $object->UnrelatedPackage::some_subroutine() (not for me)
in thread $object->UnrelatedPackage::some_subroutine()
$ perl -e 'Lie->Pkg::Meth()' Can't locate object method "Meth" via package "Pkg" (perhaps you forgo +t to load "Pkg"?) at -e line 1.
Is this a new or unstable feature?
I checked 5.8.1-RC3 (works), 5.8.0 (works), 5.6.1 (works).
And contrary to what I thought, you do not have to use a blessed reference, a package name is fine as well. It also works with a string scalar:
$ perl -e '$a = "Lie"; $a->Pkg::Meth()' Can't locate object method "Meth" via package "Pkg" (perhaps you forgo +t to load "Pkg"?) at -e line 1.
But not with other types of parameters (that cannot qualify as class name or object instance):
$ perl -e '$a = []; $a->Pkg::Meth()' Can't call method "Pkg::Meth" on unblessed reference at -e line 1. $ perl -e '$a = 123; $a->Pkg::Meth()' Can't call method "Pkg::Meth" without a package or object reference at + -e line 1.
|
|---|