You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
2.2 KiB

package require punk::cap
tcl::namespace::eval punk::mix {
proc init {} {
package require punk::cap::handlers::templates ;#handler for templates cap
punk::cap::register_capabilityname punk.templates ::punk::cap::handlers::templates ;#time taken should generally be sub 200us
#todo: use tcllib pluginmgr to load all modules that provide 'punk.templates'
#review - tcllib pluginmgr 0.5 @2025 has some bugs - esp regarding .tm modules vs packages
#We may also need to better control the order of module and library paths in the safe interps pluginmgr uses.
#todo - develop punk::pluginmgr to fix these issues (bug reports already submitted re tcllib, but the path issues may need customisation)
#The punk::mix::templates module is implemented as a zip based archive (modpod header)
#This requires vfs::zip package or zipfs command in Tcl
#Both are binary requirements - either can fail on older systems.
if {[catch {
package require punk::mix::templates ;#registers as provider pkg for 'punk.templates' capability with punk::cap
} errTemplates]} {
#emit a warning - but continue on without templates anyway. (punk::mix required to load when using bootsupport paths)
puts stderr "punk::mix failed to load ZIP archive-based module punk::mix::templates\nUse a modern Tcl with zipfs, or a recent vfs::zip library\nError:$errTemplates"
puts stderr "Unable to register any template providers - continuing anyway"
} else {
set t [time {
if {[catch {punk::mix::templates::provider register *} errM]} {
puts stderr "punk::mix failure during punk::mix::templates::provider register *"
puts stderr $errM
puts stderr "-----"
puts stderr $::errorInfo
}
}]
puts stderr "->punk::mix::templates::provider register * t=$t"
}
}
init
}
package require punk::mix::base
package require punk::mix::cli
package provide punk::mix [tcl::namespace::eval punk::mix {
variable version
set version 0.2.1
}]