in reply to Re: object contstruction
in thread object contstruction
You have Module::Test inheriting from itself.Incorrect. Look again.
The following line is where your error is:That's not right. It's perfectly legal (even under strict) to use interpolated strings as package names: "M::$t"->new. Your suggestion would look for a variable named $Module::Test and call new in the package or for the object contained in that variable, which is clearly not what the OP is trying to do.I'm trying to understand what you are attempting to do here. You are wanting to call the constructor of some other class in some other Module:xxx namespace, and you are then blessing this into your passed classname.my $self = Module::$t->new;This is syntactically invalid, and also breaks strict 'refs', or rather would bresk it if you specified
my $self = ${"Module::$t"}->new;
|
|---|