Wapp

Ticket Change Details
Login
Overview

Artifact ID: 730a1d9b01abf729c8e454779c696c3ed92d9608182b6afeeed168c57981f625 (Awaiting Moderator Approval)
Ticket: 231e1accd3b5c1bb2ccc038bb99161941af9d743
Add pkgIndex.tcl
User & Date: anonymous 2023-09-06 07:54:33
Changes

  1. foundin changed to: "1.0"
  2. icomment:
    The documentation mentions that if you want to be able to `package require wapp` directly, you should build `wapptclsh`. However it's also very easy (and I would argue very useful) to set up wapp to be directly compatible with vanilla `tclsh`. If you put a `pkgIndex.tcl` file in the root dir with the following contents:
    
    `package ifneeded wapp 1.0 [list source [file join $dir wapp.tcl]]`
    
    ... and make sure the root dir is directly or indirectly in [auto_path](https://wiki.tcl-lang.org/page/auto_path), wapp will act as a normal Tcl package.
    
    If you put the `pkgIndex.tcl` file and the following `testwapp.tcl` file inside the root dir:
    
        lappend auto_path [file dirname [info script]]
        
        package require wapp
        
        proc wapp-default {} {
          wapp-subst {<h1>Hello, World!</h1>\n}
        }
        wapp-start $argv
    
    
    You can get a "Hello World" page with just `tclsh testwapp.tcl`. If you install wapp as a system-wide library you won't need to touch the `auto_path` at all, this is just done for testing purposes here.
    
    Adding a `pkgIndex.tcl` file would make wapp's usage identical to that of other Tcl packages like the ones in Tcllib and would make it easier to embed it in a larger Tcl application.
    
  3. login: "anonymous"
  4. mimetype: "text/x-markdown"
  5. private_contact changed to: "8982a851333466c77485b64f16aa683016dd9fdc"
  6. severity changed to: "Important"
  7. status changed to: "Open"
  8. title changed to: "Add pkgIndex.tcl"
  9. type changed to: "Feature_Request"