Glib::Object::Subclass, embedding and multiple interpreters



I have a program that uses GTK+ and has a built-in Perl interpreter. I've discovered that gtk2-perl works perfectly from this program, and this allows for nice extensibility of the program via Perl scripts using gtk2-perl.

However, the program can, in fact, have multiple Perl interpreters, running simultaneously. This in itself does not cause problems, but one thing happened when I tried to create a subclassed object deriving from Gtk2::Window, using Glib::Object::Subclass to do that.

The first time the file that defines this new subclassed widget is loaded, everything works perfectly, and it can be used normally. However, if I try to load another interpreter, and to load the file again in this new interpreter, I get some error messages saying that the object cannot be registered, because it already it --- what makes sense, naturally.

My (first) question is if there is a way to check if the type is already registered, and if it is, to ignore the registration process. This probably would mean that I would not be able to use Glib::Object::Subclass and I would need to do things manually, but that's OK.

However, this brings another question: would that work? Even if the registration process were skipped for the second time the object is defined, there might be references somewhere to things of the first interpreter, and then trying to use the subclassed object from another interpreter would not work. So, before knowing how it is possible to do what I want above, if that _is_ possible and wheter it would work. Could anyone shed a light on this?

--
<Ze0> so, how's everything in the world of Quack?
<LordHavoc> just ducky
<Ze0> excellent, fried duck is mighty fine tasty.

Eduardo M KALINOWSKI
ekalin bol com br
http://move.to/hpkb




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]