in reply to Re^2: require in script breaks module
in thread require in script breaks module

Peeking inside the .ph file on my machines, it's mostly just more requires.

Yes, the "load a file only once" logic with %INC would apply to every require call. I don't have enough time to test right now, but assuming that those files don't load any other modules, an ugly hack might be { package Foo; local %INC; require "..."; }

By the way, I took a look at your commit, and I noticed this logic:

eval { require 'sys/ioctl.ph' }; $Tcl::pTk::_FE_unavailable = $@; ... if ($Tcl::pTk::_FE_unavailable) { ...

Be aware of Bug in eval in pre-5.14 and that $@ may not be a true value after an eval failure. The better pattern would be for example:

eval { require 'sys/ioctl.ph'; 1 } or do { $Tcl::pTk::_FE_unavailable = $@||'unknown error'; };

because in this case $Tcl::pTk::_FE_unavailable will always be a true value if an error occurs, even if $@ is not.