As I said, the thing is, PerlQt is "many packages in one", so one needs to define this for, e.g. Qt.pm, Qt/Object.pm, Qt/Application.pm, and so on. Also, simple code like
use Qt; import Qt::app; $hello = Qt::PushButton->new('Hello'); $hello->resize(100, 30); $app->setMainWidget($hello); $hello->show(); exit $app->exec();
becomes
and more complex examples end up having dozens of "use" statements, which is kinda inconvenient. The original piece of code was pretty inventive about this: all Qt::*::AUTOLOAD methods were directed (newXSUB'ed) to the same place, so a single "use Qt" was enough. Right now I am thinking of overloading "new" and "DESTROY" methods of each class with what used to be "AUTOLOAD". In the original code, AUTOLOAD on each object was used only once, and whan it did, it loaded (newXS'ed) the real methods (I think the guy did that for optimization). Since every object in PerlQt has both "new" and "DESTROY", the "fake new" e.g. procedure would be overriden immediately after it is called. This approach seems to work better, although there are some subtleties that I have to take care of.use Qt; use Qt::Object; use Qt::Application; use Qt::PushButton; use Qt::Font; import Qt::app; $hello = Qt::PushButton->new('Hello'); $hello->resize(100, 30); $app->setMainWidget($hello); $hello->show(); exit $app->exec();
This all brings me to one thing: my God, how I wish Perl5 along with perlguts soecs was standartized!
best,
Mishka
In reply to Re: (tye)Re2: Help: 5.6.1: XSUB and AUTOLOAD
by Anonymous Monk
in thread Help: 5.6.1: XSUB and AUTOLOAD
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |