Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Tcl::pTk Can't locate object method "findINC" via package "Tk"

by chrstphrchvz (Scribe)
on Jul 20, 2018 at 01:13 UTC ( [id://1218860]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Tcl::pTk Can't locate object method "findINC" via package "Tk"
in thread Tcl::pTk Can't locate object method "findINC" via package "Tk"

Update 2019-02-26: disregard my hypothesis below; I've since figured out what the issue was and addressed it in Tcl::pTk 0.95. See my newer reply.

Howdy, I was recently added as a co-maintainer of Tcl::pTk, so I wish I had come across this question earlier.

Indeed this sounds like part of the program is trying to use Tk but Tcl::pTk::TkHijack isn't loaded. Having Tcl::pTk installed does not make Perl/Tk programs automatically use it. To summarize what's documented, using Tcl::pTk with an existing program requires (from most to least effort) either:

  1. substituting all mentions of Tk with Tcl::pTk, i.e. use Tk; with use Tcl::pTk;, any Tk::package or Tk->thing with Tcl::pTk::package or Tcl::pTk->thing, etc.;
  2. putting use Tcl::pTk::TkHijack; (BEFORE any existing use Tk;) at the top of the program's main script;
  3. running the program's script using the -MTcl::pTk::TkHijack command-line parameter, i.e. perl -MTcl::pTk::TkHijack my_tk_program.pl.

I find the command line parameter approach the easiest for testing an entire program without changing any code; that way I can still run it with Perl/Tk for comparison or when something breaks under Tcl::pTk. The use Tcl::pTk::TkHijack; approach has the same effect, and just that line will need to be commented out to go back to Perl/Tk. Then, for programs "ready" to be run only with Tcl::pTk (i.e. Tcl::pTk doesn't break for your program) and you don't want to use Perl/Tk anymore, then the first approach might work better.

PS: I put out a new version of Tcl::pTk recently (0.93), though there isn't any changes that would affect this findINC issue. I also added Tcl::pTk to MacPorts, which uses Tcl/Tk 8.6.8. Note that macOS comes with an older version of Tcl/Tk (8.5.9 in macOS 10.13); some improvements for macOS aqua have since been added in e.g. 8.6.8.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1218860]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-03-19 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found