in reply to how to create instances of classes ....
The ref function returns the class name of an object, so you can bless a reference into a class with it,
There is no assurance that Foo's instance methods will work with $fake. Know what your classes are like before you do this.my $object = Foo->new; my $fake = bless {}, ref $object; my $real = (ref $object)->new;
You can bless a reference into any namespace you like - it doesn't even have to exist in the symbol table.
After Compline,
Zaxo
|
|---|