in reply to $foo = "Foo::Bar"; $foo->new() works?
When you get down to it, a perl namespace is just a string. It gets mapped into the symbol table by simple trickery involving string operations.
A class constructor method new() usually starts with,
then goes on to generate some suitable $self, and ends with,sub new { my $class = shift;
which is typically all that's done with $class.bless $self, $class; }
If you look at the docs for bless, you'll see that all it needs is a string in the second argument. There is nothing to prevent you from blessing a reference into any string you like:
Of course that will fail to find any methods for $vanilla if you try to use them.perl -Mstrict -we'my $vanilla = bless {}, "Im a Pudding"; print ref $v +anilla, $/' Im a Pudding
So you're doing the right thing. There are no reference or alias issues, and strict doesn't raise a peep.
After Compline,
Zaxo
|
---|