Posted to tcl by jeremy_c at Wed Sep 19 16:54:34 GMT 2007view raw

  1. # ~/.example/plugins/pkgIndex.tcl
  2. package ifneeded ::example::plugins::simple 0.1 [list source [file join $dir simple.tcl]]
  3.  
  4. # ~/.example/plugins/simple.tcl
  5. proc hello {} {
  6. puts "Hello"
  7. }
  8.  
  9. proc goodbye {} {
  10. puts "Goodbye"
  11. }
  12.  
  13. package provide ::example::plugins::simple 0.1
  14.  
  15. # ~/develop/learning/pluginsystem/example.tcl
  16.  
  17. package require pluginmgr
  18.  
  19. set plugApi { hello goodbye }
  20.  
  21. pluginmgr plug -pattern ::example::plugins::* -api $plugApi
  22. pluginmgr::paths plug ::example
  23. plug load simple