in reply to Re^2: Perl OO: switch package context.
in thread Perl OO: switch package context.
As a constant is nothing but a sub, you can use a similar sub that just returns the value of a scalar. You can always change the value for the scalar.
You can always still change the value of that scalar.my $class = "Gemini::Model::Object"; sub Object () { return $class; } print ref Object->new();
But why the obfuscation? If you want to use a variable class, just say so. Perl lets you do that.
Looks fine to me.my $class = "Gemini::Model::Object"; print ref $class->new();
|
|---|