Rafael Garcia-Suarez wrote: >> $obj = $pkg->new(); # unambiguously call class method > >That works with $pkg being a string, right now. No, that's how I started this thread. If $pkg is, say, the string "Foo::Bar", then it is ambiguous between the package Foo::Bar and the I/O handle *Foo::Bar{IO}. The I/O handle meaning takes precedence, if there is a handle of that name. $ perl -E 'package Foo::Bar { sub say { say "Foo::Bar::say(@_)" } } open(\*Foo::Bar, ">&STDOUT"); $pkg = "Foo::Bar"; $pkg->say(123)' 123 >I would prefer avoiding thinking about $pkg as a special kind of >object. You're thinking of "object" in the OO sense. I meant it in the looser sense, of anything that the language can manipulate by first-class mechanisms. It's an object in the same sense in which an (unblessed) array is an object. We could well call it merely a "package". It would probably end up implemented as an svtype, SVt_PVPK. -zeframThread Previous | Thread Next