Re: [tcltk-perl] why autoloading in Tcl/Tk do not work from Tcl::Tk?
Brought to you by:
hobbs
From: Jeff H. <je...@ac...> - 2004-05-02 17:11:14
|
Vadim Konovalov wrote: > Does anyone has an idea why autoloading does not fully functioning when > Tcl/Tk is used from Perl? > > As an example, > $interp->call('tk_setPalette', $color); > does not work: it fails to find tk_setPalette procedure > > But following works: > $interp->Eval('tk_setPalette '.$color); > > and once that code is executed previous piece of code also works properly. The eval goes through a different path that will invoke the unknown mechanism (which handles auto-loading), whereas the icall function as written only ever invokes a command if it already exists - it does NOT allow for autoloading. This is the crux of the difference between the pre-existing icall function and the alternative that I wrote (but is not used by default). See the comments in the C code. Perhaps you do want to use my icall function by default instead? Other things you miss are command tracing and async checks. The current icall function to the lowest level to make its calls, which may be desired ... but perhaps we should make them 2 alternate functions, with the default 'icall' being my alternative function, and 'invoke' being the current 'icall'? BTW, I would also like to see a core 'catch' function, for handling Tcl calls that may well error in a more perl-ish integrated way. -- Jeff Hobbs, The Tcl Guy http://www.ActiveState.com/, a division of Sophos |