Well, I was thinking more along the lines of:
sub AUTOLOAD {
AutoLoad( $AUTOLOAD, @_ );
}
and have AutoLoad() be the XS routine. Passing in $AUTOLOAD could be optional since you probably already have code that knows how to fetch that.
But maybe something that simple wouldn't be enough to overcome the bug you hit. (:
-
tye
(but my friends call me "Tye") | [reply] [d/l] |
That's exactly what I tried to do.
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
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();
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.
This all brings me to one thing: my God, how I wish Perl5 along with perlguts soecs was standartized!
best,
Mishka | [reply] [d/l] [select] |